threeal / leetspace

A dedicated workspace and archive for my LeetCode submissions
https://leetcode.com/threeal
MIT License
1 stars 1 forks source link

Solve Problem 1605. Find Valid Matrix Given Row and Column Sums #1368

Closed threeal closed 1 month ago

threeal commented 1 month ago

This issue suggests solving the problem 1605. Find Valid Matrix Given Row and Column Sums. To achieve this, one can find the smallest value between the row sum and column sum, and then assign that value to the unassigned element. For example, given the following from the first example:

x x 3
x x 8
4 7

The overall process is as follows:

Therefore, the resulting matrix is:

3 0
1 7