新年好呀!
代码:
class Solution: def construct2DArray(self, original: List[int], m: int, n: int) -> List[List[int]]: if len(original) != m * n: return [] ans = [[0] * n for _ in range(m)] for i in range(len(original)): r = i // n c = i % n ans[r][c] = original[i] return ans
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)