Skip to content
This repository was archived by the owner on Sep 22, 2021. It is now read-only.

Commit 3b25489

Browse files
authored
Merge pull request #413 from TrushaT/add-1605-code
Added 1605_Find_Valid_Matrix_Given_Row_and_Column_Sum
2 parents e48dfe8 + 38b1e3b commit 3b25489

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution:
2+
def restoreMatrix(self, rowSum: List[int], colSum: List[int]) -> List[List[int]]:
3+
m = len(rowSum)
4+
n = len(colSum)
5+
matrix = [[0]*n for i in range(m)]
6+
print(matrix)
7+
for i in range(m):
8+
for j in range(n):
9+
matrix[i][j] = min(rowSum[i],colSum[j])
10+
rowSum[i] -= matrix[i][j]
11+
colSum[j] -= matrix[i][j]
12+
return matrix
13+

0 commit comments

Comments
 (0)