C++ || Reshape the Matrix || Easy understanding
\nclass Solution {\npublic:\n    vector<vector<int>> matrixReshape(vector<vector<int>>& mat, int r, int c) {\n        \n        int m = mat.size();\n        int
```\nclass Solution {\npublic:\n    vector<vector<int>> matrixReshape(vector<vector<int>>& mat, int r, int c) {\n        \n        int m = mat.size();\n        int n = mat[0].size();\n        \n        if(m * n != r * c) {\n            return mat;\n        }\n        \n        vector<vector<int>> res(r, vector<int>(c));\n        int row = 0, col = 0;\n        for(int i = 0; i < m; i++) {\n            for(int j = 0; j < n; j++) {\n                res[row][col] = mat[i][j];\n                col += 1;\n                if(col == c) {\n                    row += 1;\n                    col = 0;\n                }\n            }\n        }\n        return res;\n    }\n};\n```\nPlease **UpVote**, if you understood the problem.
['C', 'Matrix', 'C++']