Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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‎

Lines changed: 1 addition & 4 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /