```
def minimumTotal(self, triangle):
if not triangle or not triangle[0]: return float("-inf")
arr=[float("inf") for i in range(len(triangle)+1)]
arr[1]=0
for i in range(1, len(triangle)+1):
for j in range(len(triangle[i-1]), 0, -1):
arr[j]=min(arr[j-1],arr[j])+triangle[i-1][len(triangle[i-1])-j]
return min(arr[1:])
```