https://leetcode.com/problems/triangle/


Time Limit Exceeded


```python
class Solution:
    def minimumTotal(self, triangle: List[List[int]]) -> int:
        #8:41
        self.tempSet = set()
        height = len(triangle)
        
        def next(sum_, index_y, index_x):
            if (index_y > height - 2):
                self.tempSet.add(sum_)
                return
            
            sub_a = triangle[index_y+1][index_x]
            sub_b = triangle[index_y+1][index_x+1]
            a = sum_ + sub_a
            b = sum_ + sub_b
            next(a, index_y+1, index_x)
            next(b, index_y+1, index_x+1)
                
        next(triangle[0][0], 0, 0)
        
        return min(self.tempSet)
        #9:01
        #9:25 reconstruction and debug and no matter how I try, I always get time exceeded here
```

