C++ Easy Solution(Two approaches)
class Solution {\npublic:\n    vector> matrixReshape(vector>& mat, int r, int c) {\n\t\n        int m=mat.size();\n        int n=mat[0].size();\n        if(mn!=
class Solution {\npublic:\n    vector<vector<int>> matrixReshape(vector<vector<int>>& mat, int r, int c) {\n\t\n        int m=mat.size();\n        int n=mat[0].size();\n        if(m*n!=r*c)return mat;\n        vector<vector<int>>newm(r,vector<int>(c));\n         for(int i=0;i<m*n;i++)\n        {\n           newm[i/c][i%c]=mat[i/n][i%n];\n        }\n        return newm;\n         }\n};\n2nd solution\n\nclass Solution {\npublic:\n    vector<vector<int>> matrixReshape(vector<vector<int>>& mat, int r, int c) {\n\t\n        int m=mat.size();\n        int n=mat[0].size();\n        int ans=m*n;\n        int ans1=r*c;\n        if(ans!=ans1) return mat;\n        int nc=0,nr=0;\n        vector<vector<int>>v(r,vector<int>(c));\n        for(int i=0;i<m;i++)\n        {\n            for(int j=0;j<mat[i].size();j++)\n            {\n                if(nc==c)\n                {\n                    nr++;\n                    nc=0;\n                }\n                v[nr][nc]=mat[i][j];\n                nc++;\n            }\n        }\n        return v;\n        \n    }\n};\n**Please do upvote if it helped**
['C']