Minimum Number of Operations to Convert Time

๐ง Problem
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.
๐ท๏ธ Tags
string, greedy
๐ Difficulty
Easy
โ
Success Rate: 61.8%
๐ฅ Submissions: 27,654
๐ Accepted: 17,096
โค๏ธ Reactions
๐ Likes: 133
๐ Dislikes: 17
๐ก Hints
Convert the times to minutes. Use the operation with the biggest value possible at each step.
๐ Similar Questions
- Coin Change
Leetcode Link : Minimum Number of Operations to Convert Time
Subscribe to my newsletter
Read articles from RedAurther directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
