Java ordered linked list, beat 100%, 11ms
\n    class Node {\n        int x, h;\n        Node next;\n        Node(int x, int h) {\n            this.x = x;\n            this.h = h;\n        }\n    }\n   
```\n    class Node {\n        int x, h;\n        Node next;\n        Node(int x, int h) {\n            this.x = x;\n            this.h = h;\n        }\n    }\n    public List<Integer> fallingSquares(int[][] positions) {\n        int n = positions.length, max = 0;\n        List<Integer> ans = new ArrayList<>();\n        Node head = new Node(0, 0);\n        for (int[] p : positions) {\n            Node prev = head;\n            while (prev.next != null && prev.next.x < p[0]) {\n                prev = prev.next;\n            }\n            int lasth = prev.h;\n            int h = (prev.next == null || prev.next.x > p[0]) ? prev.h + p[1] : p[1];\n            Node post = prev.next;\n            while (post != null && post.x < p[0] + p[1]) {\n                h = Math.max(h, post.h + p[1]);\n                lasth = post.h;\n                post = post.next;\n            }\n            Node cur = new Node(p[0], h);\n            prev.next = cur;\n            if (post == null || post.x > p[0] + p[1]) {\n                cur.next = new Node(p[0] + p[1], lasth);\n                cur = cur.next;\n            }\n            cur.next = post;\n            max = Math.max(max, h);\n            ans.add(max);\n        }\n        return ans;\n    }\n```
[]