CoolFace
Datasetpublic

TheRealSamuel/LeetCodeProblem

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes574downloads
1{2    "id": 2345,3    "name": "minimum_number_of_operations_to_convert_time",4    "difficulty": "Easy",5    "link": "https://leetcode.com/problems/minimum-number-of-operations-to-convert-time/",6    "date": "1648339200000",7    "task_description": "You are given two strings `current` and `correct` representing two **24-hour times**. 24-hour times are formatted as `\"HH:MM\"`, where `HH` is between `00` and `23`, and `MM` is between `00` and `59`. The earliest 24-hour time is `00:00`, and the latest is `23:59`. In one operation you can increase the time `current` by `1`, `5`, `15`, or `60` minutes. You can perform this operation **any** number of times. Return _the **minimum number of operations** needed to convert _`current`_ to _`correct`. **Example 1:** ``` **Input:** current = \"02:30\", correct = \"04:35\" **Output:** 3 **Explanation: **We can convert current to correct in 3 operations as follows: - Add 60 minutes to current. current becomes \"03:30\". - Add 60 minutes to current. current becomes \"04:30\". - Add 5 minutes to current. current becomes \"04:35\". It can be proven that it is not possible to convert current to correct in fewer than 3 operations. ``` **Example 2:** ``` **Input:** current = \"11:00\", correct = \"11:01\" **Output:** 1 **Explanation:** We only have to add one minute to current, so the minimum number of operations needed is 1. ``` **Constraints:** `current` and `correct` are in the format `\"HH:MM\"` `current <= correct`",8    "public_test_cases": [9        {10            "label": "Example 1",11            "input": "current = \"02:30\", correct = \"04:35\"",12            "output": "3 "13        },14        {15            "label": "Example 2",16            "input": "current = \"11:00\", correct = \"11:01\"",17            "output": "1 "18        }19    ],20    "private_test_cases": [21        {22            "input": [23                "\"07:16\"",24                "\"09:14\""25            ],26            "output": 927        },28        {29            "input": [30                "\"22:58\"",31                "\"23:22\""32            ],33            "output": 634        },35        {36            "input": [37                "\"15:13\"",38                "\"17:14\""39            ],40            "output": 341        },42        {43            "input": [44                "\"13:15\"",45                "\"17:22\""46            ],47            "output": 748        },49        {50            "input": [51                "\"14:02\"",52                "\"17:45\""53            ],54            "output": 1055        },56        {57            "input": [58                "\"05:30\"",59                "\"20:53\""60            ],61            "output": 2062        },63        {64            "input": [65                "\"04:17\"",66                "\"15:12\""67            ],68            "output": 1569        },70        {71            "input": [72                "14:30",73                "14:47"74            ],75            "output": 376        },77        {78            "input": [79                "16:15",80                "22:13"81            ],82            "output": 1383        },84        {85            "input": [86                "23:54",87                "23:58"88            ],89            "output": 490        }91    ],92    "haskell_template": "convertTime :: String -> String -> Int\nconvertTime current correct ",93    "ocaml_template": "let convertTime (current: string) (correct: string) : int =  ",94    "scala_template": "def convertTime(current: String,correct: String): Int = { \n    \n}",95    "java_template": "public static int convertTime(String current, String correct) {\n\n}",96    "python_template": "class Solution(object):\n    def convertTime(self, current, correct):\n        \"\"\"\n        :type current: str\n        :type correct: str\n        :rtype: int\n        \"\"\"\n        "97}