30:00
Given a binary array nums, return the length of the longest run of consecutive 1s in it.
1≤nums.length≤1051 \leq \text{nums.length} \leq 10^51≤nums.length≤105
nums[i]\text{nums}[i]nums[i] is either 000 or 111.
Run code to see results.
Scan 6 bits once, tracking the live streak (cur) and the record (best).
nums (6 bits)
▬ best streak
▬ current streak
0
1
2
3
4
5
cur
best
Given an array of 0s and 1s, return the length of the longest unbroken run of 1s.