Clean python code


  • 0
    class Solution(object):
        def maxProfit(self, prices):
            return sum([
                max(prices[i] - prices[i - 1], 0) for i in xrange(1, len(prices))])

Log in to reply
 

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