DP tabular solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int countSquares(vector<vector<int>>& m) {\n        int r=m.size();\n        int c= m[0].size();\n        int count=0;\n\n        for(int i=1;i<r;i++)\n        {\n            for(int j=1;j<c;j++)\n            {\n                if(m[i][j]==1)\n                {\n                    m[i][j]= min(m[i-1][j-1],min(m[i-1][j],m[i][j-1]))+1;\n                }\n            }\n        }\n         for(int i=0;i<r;i++)\n        {\n            for(int j=0;j<c;j++)\n            {\n                count+=m[i][j];\n            }\n        }\n        return count;\n        \n    }\n};\n```
['C++']