Brilliant (buyaolian) Python solution


  • 0
    Y

    simple and neat

        result=triangle
        for i in range(1,len(triangle)):
            for j in range(1,len(triangle[i])-1):
                result[i][j]+=min(result[i-1][j-1],result[i-1][j])
            result[i][0]+=result[i-1][0]
            result[i][i]+=result[i-1][i-1]
                
        return min(result[len(triangle)-1])

Log in to reply
 

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