Python Hard
```python3 []
class Solution:
    def fallingSquares(self, positions: List[List[int]]) -> List[int]:
        prev = []

       
        def overlap(l, r, left, right):
          
            return not (r <= left or right <= l)


        ans = []
        mx = 0

        for left, sideLength in positions:
            right = left + sideLength

            max_height = 0

            


            for l, r, h in prev:
                if overlap(l, r, left, right):
                    max_height = max(max_height, h)

            max_height += sideLength
            mx = max(mx, max_height)

            prev.append((left, right, max_height))


            ans.append(mx)


        
        return ans
```
['Python3']