6 kyu

Zero-plentiful Array

1,370 of 2,458aweleshetu

Description:

An array is called zero-plentiful if it contains multiple zeros, and every sequence of zeros is at least 4 items long.

Your task is to return the number of zero sequences if the given array is zero-plentiful, otherwise 0.

Examples

[0, 0, 0, 0, 0, 1]  -->  1
# 1 group of 5 zeros (>= 4), thus the result is 1

[0, 0, 0, 0, 1, 0, 0, 0, 0]  -->  2
# 2 group of 4 zeros (>= 4), thus the result is 2

[0, 0, 0, 0, 1, 0]  -->  0 
# 1 group of 4 zeros and 1 group of 1 zero (< 4)
# _every_ sequence of zeros must be at least 4 long, thus the result is 0

[0, 0, 0, 1, 0, 0]  -->  0
# 1 group of 3 zeros (< 4) and 1 group of 2 zeros (< 4)

[1, 2, 3, 4, 5]  -->  0
# no zeros

[]  -->  0
# no zeros
Fundamentals

Stats:

CreatedOct 14, 2017
PublishedOct 14, 2017
Warriors Trained5104
Total Skips121
Total Code Submissions34690
Total Times Completed2458
JavaScript Completions1370
Python Completions980
C Completions119
Ruby Completions55
Factor Completions8
Total Stars97
% of votes with a positive feedback rating92% of 425
Total "Very Satisfied" Votes367
Total "Somewhat Satisfied" Votes48
Total "Not Satisfied" Votes10
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • aweleshetu Avatar
  • anter69 Avatar
  • Voile Avatar
  • KenKamau Avatar
  • monadius Avatar
  • trashy_incel Avatar
  • Twilight_Sun Avatar
  • Kacarott Avatar
  • tri@ Avatar
  • sid114 Avatar
Ad