easyLoops and basics target 15 min
Longest run of ones
A list bits holds only 0s and 1s. Return the length of the longest unbroken run of 1s.
Example 1
Input
bits = [1, 1, 0, 1, 1, 1]Output3The last three items are a run of three 1s.
Example 2
Input
bits = [1, 0, 1, 1, 0, 1]Output2Constraints
1 ≤ len(bits) ≤ 10^5
Every item is 0 or 1.
Run examples checks the examples. Submit runs every test, including edge cases and a large input.