Python with dict, O(N^2) solution with comments
\nclass Solution:\n    def fallingSquares(self, positions):\n        """\n        :type positions: List[List[int]]\n        :rtype: List[int]\n        """\n    
```\nclass Solution:\n    def fallingSquares(self, positions):\n        """\n        :type positions: List[List[int]]\n        :rtype: List[int]\n        """\n        ans = []\n        heights = {}\n        for pos, side in positions:\n            # finds nearby positions, if any\n            left, right = pos, pos+side-1\n            # compare to see if this block overlaps with L/R boundaries of existing blocks\n            nearby = [key for key in heights.keys() if not (key[1] < pos or key[0] > right)]\n            # finds height of block based on heights of existing and overlapping blocks\n            if len(nearby) > 0:\n                h = max(heights[key] for key in nearby) + side\n            else:\n                h = side\n            # update the heights for left and right boundaries\n            heights[(pos,right)] = h\n            # add height to ans\n            if len(ans) == 0:\n                ans.append(h)\n            else:\n                ans.append(max(h,ans[-1]))\n        return ans\n```
[]