Really really slow one liner (Python)


  • 0
    G
    class Solution(object):
        def findMaxConsecutiveOnes(self, nums):
            return max(reduce(lambda acc, i: acc[:-1]+[acc[-1]+1] if i==1 else acc+[0],nums,[0]))

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.