Short Java solution !!!
\n    int max = Integer.MIN_VALUE;\n\t\t\n    public List<Integer> fallingSquares(int[][] p) {\n        List<int[]> list = new ArrayList<>();\n        List<Inte
```\n    int max = Integer.MIN_VALUE;\n\t\t\n    public List<Integer> fallingSquares(int[][] p) {\n        List<int[]> list = new ArrayList<>();\n        List<Integer> ans = new ArrayList<>();\n        for (int[] s : p) {\n            int[] node = new int[]{s[0], s[0] + s[1], s[1]};\n            ans.add(getMax(list, node));\n        }\n        return ans;\n    }\n    \n    private int getMax(List<int[]> list, int[] node) {\n        int height = 0;\n        for (int[] e : list) {\n            if(e[0] >= node[1] || e[1] <= node[0]) continue;\n            height = Math.max(height, e[2]);\n        }\n        node[2] += height;\n        list.add(node);\n        max = Math.max(max, node[2]);\n        return max;\n    }\n```
[]