[JavaScript] JS 3 liner - 90% faster solution
\nvar matrixReshape = function(mat, r, c) {\n    const flat = mat.flat()\n    if (flat.length !== r*c) return mat;\n    return [...Array(r)].map(() => flat.spli
```\nvar matrixReshape = function(mat, r, c) {\n    const flat = mat.flat()\n    if (flat.length !== r*c) return mat;\n    return [...Array(r)].map(() => flat.splice(0,c)) \n};\n```
['JavaScript']