1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-22 21:46:46 +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

@@ -2,7 +2,7 @@
"data": {
"question": {
"questionId": "2345",
"questionFrontendId": "6055",
"questionFrontendId": "2224",
"categoryTitle": "Algorithms",
"boundTopicId": 1385485,
"title": "Minimum Number of Operations to Convert Time",
@@ -12,13 +12,26 @@
"translatedContent": "<p>给你两个字符串 <code>current</code> 和 <code>correct</code> ,表示两个 <strong>24 小时制时间</strong> 。</p>\n\n<p><strong>24 小时制时间</strong> 按 <code>\"HH:MM\"</code> 进行格式化,其中 <code>HH</code> 在 <code>00</code> 和 <code>23</code> 之间,而 <code>MM</code> 在 <code>00</code> 和 <code>59</code> 之间。最早的 24 小时制时间为 <code>00:00</code> ,最晚的是 <code>23:59</code> 。</p>\n\n<p>在一步操作中,你可以将 <code>current</code> 这个时间增加 <code>1</code>、<code>5</code>、<code>15</code> 或 <code>60</code> 分钟。你可以执行这一操作 <strong>任意</strong> 次数。</p>\n\n<p>返回将&nbsp;<code>current</code><em> </em>转化为<em> </em><code>correct</code> 需要的 <strong>最少操作数</strong> 。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>current = \"02:30\", correct = \"04:35\"\n<strong>输出:</strong>3\n<strong>解释:\n</strong>可以按下述 3 步操作将 current 转换为 correct \n- 为 current 加 60 分钟current 变为 \"03:30\" 。\n- 为 current 加 60 分钟current 变为 \"04:30\" 。 \n- 为 current 加 5 分钟current 变为 \"04:35\" 。\n可以证明无法用少于 3 步操作将 current 转化为 correct 。</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>current = \"11:00\", correct = \"11:01\"\n<strong>输出:</strong>1\n<strong>解释:</strong>只需要为 current 加一分钟,所以最小操作数是 1 。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>current</code> 和 <code>correct</code> 都符合 <code>\"HH:MM\"</code> 格式</li>\n\t<li><code>current &lt;= correct</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 3,
"likes": 7,
"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": "Greedy",
"slug": "greedy",
"translatedName": "贪心",
"__typename": "TopicTagNode"
},
{
"name": "String",
"slug": "string",
"translatedName": "字符串",
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": [
{
@@ -130,7 +143,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"6.4K\", \"totalSubmission\": \"9.5K\", \"totalAcceptedRaw\": 6434, \"totalSubmissionRaw\": 9485, \"acRate\": \"67.8%\"}",
"stats": "{\"totalAccepted\": \"8.7K\", \"totalSubmission\": \"12.6K\", \"totalAcceptedRaw\": 8735, \"totalSubmissionRaw\": 12648, \"acRate\": \"69.1%\"}",
"hints": [
"Convert the times to minutes.",
"Use the operation with the biggest value possible at each step."