class Solution:
    def get_min_path(self, triangle):
        """
        type triangle: List[List[int]]
        rtype: int
        """

        if not triangle:
            return 0

        for row in range(len(triangle) - 2, -1, -1):
            for col in range(row + 1):
                triangle[row][col] += min(triangle[row + 1][col], triangle[row + 1][col + 1])
        
        return triangle[0][0]

triangle = [[2], [3, 4], [6, 5, 7], [4, 1, 8, 3]]
solution = Solution()
print(solution.get_min_path(triangle))