mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-02 14:12:17 +08:00
update
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2324",
|
||||
"questionFrontendId": "6034",
|
||||
"questionFrontendId": "2221",
|
||||
"categoryTitle": "Algorithms",
|
||||
"boundTopicId": 1385552,
|
||||
"title": "Find Triangular Sum of an Array",
|
||||
@@ -12,13 +12,38 @@
|
||||
"translatedContent": "<p>给你一个下标从 <strong>0</strong> 开始的整数数组 <code>nums</code> ,其中 <code>nums[i]</code> 是 <code>0</code> 到 <code>9</code> 之间(两者都包含)的一个数字。</p>\n\n<p><code>nums</code> 的 <strong>三角和</strong> 是执行以下操作以后最后剩下元素的值:</p>\n\n<ol>\n\t<li><code>nums</code> 初始包含 <code>n</code> 个元素。如果 <code>n == 1</code> ,<strong>终止</strong> 操作。否则,<strong>创建</strong> 一个新的下标从 <strong>0</strong> 开始的长度为 <code>n - 1</code> 的整数数组 <code>newNums</code> 。</li>\n\t<li>对于满足 <code>0 <= i < n - 1</code> 的下标 <code>i</code> ,<code>newNums[i]</code> <strong>赋值</strong> 为 <code>(nums[i] + nums[i+1]) % 10</code> ,<code>%</code> 表示取余运算。</li>\n\t<li>将 <code>newNums</code> <strong>替换</strong> 数组 <code>nums</code> 。</li>\n\t<li>从步骤 1 开始 <strong>重复</strong> 整个过程。</li>\n</ol>\n\n<p>请你返回 <code>nums</code> 的三角和。</p>\n\n<p> </p>\n\n<p><strong>示例 1:</strong></p>\n\n<p><img alt=\"\" src=\"https://assets.leetcode.com/uploads/2022/02/22/ex1drawio.png\" style=\"width: 250px; height: 250px;\" /></p>\n\n<pre>\n<b>输入:</b>nums = [1,2,3,4,5]\n<b>输出:</b>8\n<strong>解释:</strong>\n上图展示了得到数组三角和的过程。</pre>\n\n<p><strong>示例 2:</strong></p>\n\n<pre>\n<b>输入:</b>nums = [5]\n<b>输出:</b>5\n<b>解释:</b>\n由于 nums 中只有一个元素,数组的三角和为这个元素自己。</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 <= nums.length <= 1000</code></li>\n\t<li><code>0 <= nums[i] <= 9</code></li>\n</ul>\n",
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"likes": 1,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": "{\"cpp\": true, \"java\": true, \"python\": true, \"python3\": true, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"ruby\": false, \"bash\": false, \"swift\": false, \"golang\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"kotlin\": false, \"rust\": false, \"php\": false, \"typescript\": false, \"racket\": false, \"erlang\": false, \"elixir\": false}",
|
||||
"topicTags": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Array",
|
||||
"slug": "array",
|
||||
"translatedName": "数组",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Math",
|
||||
"slug": "math",
|
||||
"translatedName": "数学",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Combinatorics",
|
||||
"slug": "combinatorics",
|
||||
"translatedName": "组合数学",
|
||||
"__typename": "TopicTagNode"
|
||||
},
|
||||
{
|
||||
"name": "Simulation",
|
||||
"slug": "simulation",
|
||||
"translatedName": "模拟",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": [
|
||||
{
|
||||
@@ -130,7 +155,7 @@
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"3.9K\", \"totalSubmission\": \"4.9K\", \"totalAcceptedRaw\": 3901, \"totalSubmissionRaw\": 4894, \"acRate\": \"79.7%\"}",
|
||||
"stats": "{\"totalAccepted\": \"5.2K\", \"totalSubmission\": \"6.5K\", \"totalAcceptedRaw\": 5229, \"totalSubmissionRaw\": 6523, \"acRate\": \"80.2%\"}",
|
||||
"hints": [
|
||||
"Try simulating the entire process.",
|
||||
"To reduce space, use a temporary array to update nums in every step instead of creating a new array at each step."
|
||||
|
Reference in New Issue
Block a user