254. Max Consecutive Ones
EasyArray
Given a binary array nums, return the maximum number of consecutive 1's in the array.
Examples
Input: [1,1,0,1,1,1]
Output: 3
Explanation: The trailing run of three 1's is the longest.
Constraints
- 1 <= nums.length <= 10^5
- nums[i] is either 0 or 1.
Loading...
Run checks all cases above. Submit evaluates all test cases.