LeetCode-566/220324
437 ワード
https://leetcode.com/problems/reshape-the-matrix/
Python
import numpy as np
class Solution:
def matrixReshape(self, mat: List[List[int]], r: int, c: int) -> List[List[int]]:
try:
return np.reshape(mat, (r,c)).tolist()
except:
return mat
numpyの使用Reference
この問題について(LeetCode-566/220324), 我々は、より多くの情報をここで見つけました https://velog.io/@iyong829/LeetCode-566-220324テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol