Reshape the Matrix | Python Solution
\nclass Solution:\n    def matrixReshape(self, mat, r, c):\n        rows=len(mat)\n        cols=len(mat[0])\n        newMat=[]\n        val=0\n        if rows*c
```\nclass Solution:\n    def matrixReshape(self, mat, r, c):\n        rows=len(mat)\n        cols=len(mat[0])\n        newMat=[]\n        val=0\n        if rows*cols!=r*c:\n            return mat\n        for i in range(r):\n            newMat.append([])\n            for _ in range(c):\n                newMat[i].append(mat[val//cols][val%cols])\n                val+=1\n        return newMat\n```
[]