Python3 simple solution
\nclass Solution:\n    def matrixReshape(self, nums: List[List[int]], r: int, c: int) -> List[List[int]]:\n        n = len(nums)\n        m = len(nums[0])\n    
```\nclass Solution:\n    def matrixReshape(self, nums: List[List[int]], r: int, c: int) -> List[List[int]]:\n        n = len(nums)\n        m = len(nums[0])\n        if n*m != r*c:\n            return nums\n        else:\n            l = []\n            res = []\n            for i in range(n):\n                l.extend(nums[i])\n            for i in range(r):\n                res.append(l[i*c:i*c+c])\n            return res\n```\n**If you like the solution, please vote for this**
['Python3']