NeetCode #811LC-1605MediumGreedy
← Back to All Problems

#811 · #1605 · Find Valid Matrix Given Row and Column Sums(给定行和列的和求可行矩阵)

📌 Problem Statement & Constraints

You are given two arrays rowSum (length m) and colSum (length n). Construct an m x n matrix of non-negative integers whose row sums equal rowSum and whose column sums equal colSum. It is guaranteed that at least one such matrix exists. Return any valid matrix. Constraints: 1 <= m, n <= 500, 0 <= rowSum[i], colSum[j] <= 10^8.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!