Python solution


  • 0
    Z
        result = triangle[-1]
        for row in reversed(triangle[:-1]):
            for idx, num in enumerate(row):
                result[idx] = min(result[idx],result[idx+1])+num
        return result[0]

Log in to reply
 

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