Check the problem statement here:
Max Consecutive Ones
https://leetcode.com/problems/max-con...
Python for beginners:
https://www.youtube.com/watch?v=egq7Z...
Code: class Solution: def findMaxConsecutiveOnes(self, nums: List[int]) -> int: g=""; for i in nums: g=g+str(i); e=g.split('0'); max=0; for i in e: if(max<len(i)): max=len(i); return max;
Code: class Solution: def findMaxConsecutiveOnes(self, nums: List[int]) -> int: g=""; for i in nums: g=g+str(i); e=g.split('0'); max=0; for i in e: if(max<len(i)): max=len(i); return max;
0 Comments:
Post a Comment