1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-12-18 10:04:58 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个&nbsp;<code>m * n</code>&nbsp;的矩阵,矩阵中的元素不是 <code>0</code> 就是 <code>1</code>,请你统计并返回其中完全由 <code>1</code> 组成的 <strong>正方形</strong> 子矩阵的个数。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>matrix =\n[\n&nbsp; [0,1,1,1],\n&nbsp; [1,1,1,1],\n&nbsp; [0,1,1,1]\n]\n<strong>输出:</strong>15\n<strong>解释:</strong> \n边长为 1 的正方形有 <strong>10</strong> 个。\n边长为 2 的正方形有 <strong>4</strong> 个。\n边长为 3 的正方形有 <strong>1</strong> 个。\n正方形的总数 = 10 + 4 + 1 = <strong>15</strong>.\n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>matrix = \n[\n [1,0,1],\n [1,1,0],\n [1,1,0]\n]\n<strong>输出:</strong>7\n<strong>解释:</strong>\n边长为 1 的正方形有 <strong>6</strong> 个。 \n边长为 2 的正方形有 <strong>1</strong> 个。\n正方形的总数 = 6 + 1 = <strong>7</strong>.\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;= arr.length&nbsp;&lt;= 300</code></li>\n\t<li><code>1 &lt;= arr[0].length&nbsp;&lt;= 300</code></li>\n\t<li><code>0 &lt;= arr[i][j] &lt;= 1</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 218,
"likes": 228,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -149,7 +149,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"22.6K\", \"totalSubmission\": \"30.9K\", \"totalAcceptedRaw\": 22569, \"totalSubmissionRaw\": 30860, \"acRate\": \"73.1%\"}",
"stats": "{\"totalAccepted\": \"23.2K\", \"totalSubmission\": \"31.7K\", \"totalAcceptedRaw\": 23239, \"totalSubmissionRaw\": 31741, \"acRate\": \"73.2%\"}",
"hints": [
"Create an additive table that counts the sum of elements of submatrix with the superior corner at (0,0).",
"Loop over all subsquares in O(n^3) and check if the sum make the whole array to be ones, if it checks then add 1 to the answer."