easy JAVA Solution✅|| DP🔥
Code\n\nclass Solution {\n    public int countSquares(int[][] m) {\n        int ans=0;\n        for(int i=0;i<m.length;i++){\n            for(int j=0;j<m[0].len
# Code\n```\nclass Solution {\n    public int countSquares(int[][] m) {\n        int ans=0;\n        for(int i=0;i<m.length;i++){\n            for(int j=0;j<m[0].length;j++){\n                if(m[i][j]>0 && i>0 && j>0){\n                    m[i][j]=1+Math.min(m[i-1][j-1],Math.min(m[i-1][j],m[i][j-1]));\n                }\n                ans+=m[i][j];\n            }\n        }\n        return ans;\n    }\n}\n```
['Dynamic Programming', 'Java']