LeetCode: Max Consecutive Ones
Problem:
https://leetcode.com/problems/max-consecutive-ones/description/
Code:
class Solution:
def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
max_ones=0
consecutive_ones=0
for n in nums:
if n!=0:
...
is-power-of-two.hashnode.dev1 min read