codingforeveryone/js

new-member-10

Closed this issue · 1 comments

Given an array containing random occurrences of zeros and ones, write a function countOnes(arr) that returns the counts of the sequential ones in the array.

For example:

countOnes([0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1]) // returns [2, 4, 2]

I'd like to solve this ^_^