class Solution:
def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
#TC: O(n)
#SC: O(n)
#Use simple two pointers and sliding window
res = 0
left = 0
right = 0
count = 0
n = len(nums)
while right < n:
if nums[right] == 0:
if count == 0:
count = 1
else:
while left <= right:
if nums[left] == 0:
left += 1
break
else:
left += 1
L = right - left + 1
res = max(res, L)
right += 1
return res