C++DP Supa Neat
\nclass Solution {\npublic:\n    int countSquares(vector<vector<int>>& arr) {\n        int n = arr.size();\n        int m = arr[0].size();\n        for(int i=1;
```\nclass Solution {\npublic:\n    int countSquares(vector<vector<int>>& arr) {\n        int n = arr.size();\n        int m = arr[0].size();\n        for(int i=1;i<n;i++){\n            for(int j=1;j<m;j++){\n                if(arr[i][j])\n                arr[i][j] += min(arr[i-1][j-1],min(arr[i-1][j],arr[i][j-1]));\n            }\n        }\n        int ans = 0;\n        for(int i=0;i<n;i++){\n            for(int j=0;j<m;j++){\n                ans += arr[i][j];\n            }\n        }\n        return ans;\n    }\n};\n```
[]