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
Similar Kata:
Stats:
Created | Oct 14, 2017 |
Published | Oct 14, 2017 |
Warriors Trained | 5104 |
Total Skips | 121 |
Total Code Submissions | 34690 |
Total Times Completed | 2458 |
JavaScript Completions | 1370 |
Python Completions | 980 |
C Completions | 119 |
Ruby Completions | 55 |
Factor Completions | 8 |
Total Stars | 97 |
% of votes with a positive feedback rating | 92% of 425 |
Total "Very Satisfied" Votes | 367 |
Total "Somewhat Satisfied" Votes | 48 |
Total "Not Satisfied" Votes | 10 |
Total Rank Assessments | 11 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |