Skip to content

Commit 264980f

Browse files
committed
update: reduced a comparision on every iteration
1 parent cb5bc8a commit 264980f

File tree

1 file changed

+1
-4
lines changed
  • src/_Problems_/max-consecutive-1s

1 file changed

+1
-4
lines changed

src/_Problems_/max-consecutive-1s/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ function findMaxConsecutive1s(arr) {
1818
if (count > max) max = count;
1919
count = 0;
2020
}
21-
22-
if (i === length - 1) {
23-
if (count > max) max = count;
24-
}
2521
}
22+
if (count > max) max = count;
2623
return max;
2724
}

0 commit comments

Comments
 (0)