Beats 97%: Python List Comprehension
\nclass Solution:\n    def matrixReshape(self, mat: List[List[int]], r: int, c: int) -> List[List[int]]:\n        flat = [item for sublist in mat for item in su
```\nclass Solution:\n    def matrixReshape(self, mat: List[List[int]], r: int, c: int) -> List[List[int]]:\n        flat = [item for sublist in mat for item in sublist]\n        if r * c != len(flat): return mat    \n        output = [flat[(row *c) :c * (row +1)] for row in range(r)]\n        return output\n        \n```
['Python']