Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution:
- def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
- cur = 0
- return max((cur := (cur + 1) * n) for n in nums)
- class Solution:
- def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
- return max(accumulate(nums, lambda cur, n: (cur + 1) * n))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement