[Java] brute force, most simple...
\nclass Solution {\n    public List<Integer> fallingSquares(int[][] A) {\n        long max=0;\n        List<Integer>res=new ArrayList<>();\n       \n        Lis
```\nclass Solution {\n    public List<Integer> fallingSquares(int[][] A) {\n        long max=0;\n        List<Integer>res=new ArrayList<>();\n       \n        List<long[]>list=new ArrayList<>();\n        list.add(new long[]{0,Integer.MAX_VALUE,0});\n        \n        //can not sort\n        for(int i=0;i<A.length;i++){\n            int pair[]=A[i];\n            long len=pair[1];\n            long l=pair[0],r=l+len-1;\n            long m=0;\n            \n            for(long pos[]:list){\n                if(pos[1]<l)continue;\n                if(pos[0]>r)continue;\n                m=Math.max(m,pos[2]+len);\n            }\n            list.add(new long[]{l,r,m});\n            max=Math.max(max,m);\n            res.add((int)(max));\n        }\n        return res;\n    }\n}\n```
[]