Python binary search 44ms
\nclass Solution(object):\n    def fallingSquares(self, positions):\n        axis = [0, float(\'inf\')]\n        heights = [0, 0]\n        an = [0]\n        for
```\nclass Solution(object):\n    def fallingSquares(self, positions):\n        axis = [0, float(\'inf\')]\n        heights = [0, 0]\n        an = [0]\n        for left,length in positions:\n            right = left + length\n            idl = bisect.bisect_right(axis, left)\n            idr = bisect.bisect_left(axis, right)\n            \n            h = max(heights[idl - 1: idr]) + length\n\n            axis[idl: idr] = [left, right]\n            heights[idl: idr] = [h, heights[idr - 1]]\n            an.append(max(an[-1], h))\n\n        return an[1:]\n```
[]