Advertisement
kosievdmerwe

Untitled

Sep 21st, 2021
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. class Solution:
  2.     def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
  3.         cur = 0
  4.         return max((cur := (cur + 1) * n) for n in nums)
  5.        
  6.  
  7. class Solution:
  8.     def findMaxConsecutiveOnes(self, nums: List[int]) -> int:
  9.         return max(accumulate(nums, lambda cur, n: (cur + 1) * n))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement