O(n^2) solution with explanation
The height of the base of each box is the highest top of any other box already dropped that overlaps along the x-axis.\n\nSo for each box, we iterate over all p
The height of the base of each box is the highest top of any other box already dropped that overlaps along the x-axis.\n\nSo for each box, we iterate over all previously dropped boxes to find the base_height of the new box. The default is zero (ground level) if no overlaps are found.\nIf there is no overlap between a box and a previous box, then they are separate and will not stick, so the new box will not go on top of the previous box.\nIf there is overlap then the base_height of the new box will be the max of the previous base_height and height of the top of the previous box.\n\nStore the height of the new box as being base_height + side_length. Then append to the result the higher of the previous maximum height and this new box height. \n\n```\nclass Solution(object):\n    def fallingSquares(self, positions):\n        """\n        :type positions: List[List[int]]\n        :rtype: List[int]\n        """\n        heights, result = [], []    # heights is the top edge height for each box dropped\n        highest = 0                 # greatest height so far\n        \n        for i, position in enumerate(positions):\n\n            left, side_length = position[0], position[1]\n            \n            base_height = 0         # default if no overlap with any boxes\n            for j in range(i):      # loop over all previously dropped boxes\n                                \n                prev_left, prev_side = positions[j][0], positions[j][1]  \n                if (left + side_length <= prev_left) or (left >= prev_left + prev_side):\n                    continue        # no overlap between this box and previous box\n                base_height = max(base_height, heights[j])\n            \n            heights.append(base_height + side_length)\n            highest = max(highest, heights[-1])\n            result.append(highest)\n        \n        return result
['Python']