6 Lines of Code ----> python
\n#  please upvote me it would encourage me alot\n\n\nclass Solution:\n    def matrixReshape(self, mat: List[List[int]], r: int, c: int) -> List[List[int]]:\n  
\n#  please upvote me it would encourage me alot\n\n```\nclass Solution:\n    def matrixReshape(self, mat: List[List[int]], r: int, c: int) -> List[List[int]]:\n        list1,matrix=list(chain.from_iterable(mat)),[]\n        if len(mat)*len(mat[0])!=r*c:\n            return mat\n        for i in range(0,len(list1),c):\n            matrix.append(list1[i:i+c])\n        return matrix\n        \n```\n# please upvote me it would encourage me alot\n
['Python3']