Problem URL : https://leetcode.com/problems/find-va...
You are given two arrays rowSum and colSum of non-negative integers where rowSum[i] is the sum of the elements in the ith row and colSum[j] is the sum of the elements of the jth column of a 2D matrix. In other words, you do not know the elements of the matrix, but you do know the sums of each row and column.
Find any matrix of non-negative integers of size rowSum.length x colSum.length that satisfies the rowSum and colSum requirements.
Return a 2D array representing any matrix that fulfills the requirements. It's guaranteed that at least one matrix that fulfills the requirements exists.
Watch related videos:
▶ Lexicographical Numbers | Leetcode 386 | Interview Question for DSA - • Lexicographical Numbers | Leetcode 386 | I...
▶ Lucky Numbers in a Matrix | Leetcode 1380 | Interview Question for DSA - • Lucky Numbers in a Matrix | Leetcode 1380 ...
▶ Distribute Coins in Binary Tree | Leetcode 979 | Interview Question for DSA - • Distribute Coins in Binary Tree | Leetcode...