7 kyu

ONE ONe One one

678 of 681joh_pot

Description:

Write

function consecutiveOnes(nums) {}
        ConsecutiveOnes(nums)

that takes in array nums and returns the maximum consecutive 1's

For example

consecutiveOnes([1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0]) === 3
consecutiveOnes([1, 1, 0, 0, 1]) === 2
consecutiveOnes([0, 0, 0, 0, 0]) === 0
      ConsecutiveOnes([1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0]) => 3
      ConsecutiveOnes([1, 1, 0, 0, 1]) => 2
      ConsecutiveOnes([0, 0, 0, 0, 0]) => 0

PLEASE NOTE THAT THIS KATA HAS HEAVY PERFORMANCE TESTS AND YOU NEED OPTIMIZED CODE TO PASS IT

Arrays
Performance
Fundamentals

Stats:

CreatedJan 27, 2017
PublishedJan 27, 2017
Warriors Trained1423
Total Skips29
Total Code Submissions3440
Total Times Completed681
JavaScript Completions678
COBOL Completions6
Total Stars26
% of votes with a positive feedback rating83% of 180
Total "Very Satisfied" Votes136
Total "Somewhat Satisfied" Votes28
Total "Not Satisfied" Votes16
Total Rank Assessments12
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • joh_pot Avatar
  • HerrWert Avatar
  • Voile Avatar
  • akar-0 Avatar
  • dfhwze Avatar
  • farhanaditya Avatar
Ad