mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-22 05:26:46 +08:00
update
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
"translatedContent": "<p>给你两个非负整数数组 <code>rowSum</code> 和 <code>colSum</code> ,其中 <code>rowSum[i]</code> 是二维矩阵中第 <code>i</code> 行元素的和, <code>colSum[j]</code> 是第 <code>j</code> 列元素的和。换言之你不知道矩阵里的每个元素,但是你知道每一行和每一列的和。</p>\n\n<p>请找到大小为 <code>rowSum.length x colSum.length</code> 的任意 <strong>非负整数</strong> 矩阵,且该矩阵满足 <code>rowSum</code> 和 <code>colSum</code> 的要求。</p>\n\n<p>请你返回任意一个满足题目要求的二维矩阵,题目保证存在 <strong>至少一个</strong> 可行矩阵。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong>rowSum = [3,8], colSum = [4,7]\n<strong>输出:</strong>[[3,0],\n [1,7]]\n<strong>解释:</strong>\n第 0 行:3 + 0 = 3 == rowSum[0]\n第 1 行:1 + 7 = 8 == rowSum[1]\n第 0 列:3 + 1 = 4 == colSum[0]\n第 1 列:0 + 7 = 7 == colSum[1]\n行和列的和都满足题目要求,且所有矩阵元素都是非负的。\n另一个可行的矩阵为:[[1,2],\n [3,5]]\n</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<strong>输入:</strong>rowSum = [5,7,10], colSum = [8,6,8]\n<strong>输出:</strong>[[0,5,0],\n [6,1,0],\n [2,0,8]]\n</pre>\n\n<p><strong>示例 3:</strong></p>\n\n<pre>\n<strong>输入:</strong>rowSum = [14,9], colSum = [6,9,8]\n<strong>输出:</strong>[[0,9,5],\n [6,0,3]]\n</pre>\n\n<p><strong>示例 4:</strong></p>\n\n<pre>\n<strong>输入:</strong>rowSum = [1,0], colSum = [1]\n<strong>输出:</strong>[[1],\n [0]]\n</pre>\n\n<p><strong>示例 5:</strong></p>\n\n<pre>\n<strong>输入:</strong>rowSum = [0], colSum = [0]\n<strong>输出:</strong>[[0]]\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= rowSum.length, colSum.length <= 500</code></li>\n\t<li><code>0 <= rowSum[i], colSum[i] <= 10<sup>8</sup></code></li>\n\t<li><code>sum(rows) == sum(columns)</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 42,
|
||||
"likes": 44,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
@@ -149,7 +149,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.3K\", \"totalSubmission\": \"5.8K\", \"totalAcceptedRaw\": 4319, \"totalSubmissionRaw\": 5798, \"acRate\": \"74.5%\"}",
|
||||
"stats": "{\"totalAccepted\": \"4.5K\", \"totalSubmission\": \"6K\", \"totalAcceptedRaw\": 4505, \"totalSubmissionRaw\": 6047, \"acRate\": \"74.5%\"}",
|
||||
"hints": [
|
||||
"Find the smallest rowSum or colSum, and let it be x. Place that number in the grid, and subtract x from rowSum and colSum. Continue until all the sums are satisfied."
|
||||
],
|
||||
|
Reference in New Issue
Block a user