class Solution:
    def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
        """ O(N)/O(1)
        """
        cnt = 0
        ans = 0
        for x in nums:
            if x == 1 :
                cnt += 1
            else:
                ans = max(ans,cnt)
                cnt = 0
        # be aware of case when ptr reach the last cnt is not reset.
        ans = max(ans,cnt)
        return ans