1
2
3
4
5
6
7
8
9
10
11
12
13
|
class Solution:
def construct2DArray(self, original: List[int], m: int, n: int) -> List[List[int]]:
output=[]
n_original=len(original)
if n_original/m != n :
return output
else :
for i in range(m):
tmp_list=[]
for j in range(n):
tmp_list.append(original[n*i+j])
output.append(tmp_list)
return output
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 1702B - Polycarp Writes a String from Memory (0) | 2022.07.19 |
---|---|
codeforces 791A - Bear and Big Brother (0) | 2022.07.12 |
leetcode 2215. Find the Difference of Two Arrays (0) | 2022.07.08 |
leetcode 2303. Calculate Amount Paid in Taxes (0) | 2022.07.07 |
leetcode 1945. Sum of Digits of String After Convert (0) | 2022.07.07 |
댓글