Longest Ones After Deleting One
nums holds only 0s and 1s. You must delete exactly one item. Then look for the longest unbroken run of 1s in what is left, and return its length.
If nums has no 0 you still delete one item (a 1).
Example 1
nums [1,1,0,1]
returns 3
Delete the 0 to get [1, 1, 1], so 3.
Example 2
nums [1,1,1]
returns 2
You must delete a 1, leaving two.
Constraints
1 <= len(nums) <= 40- Each item is 0 or 1.
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.