Skip to content

Practice Minimum Number of Operations to Convert Time

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2224
LeetCode Problem

Minimum Number of Operations to Convert Time

Problem Statement

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.

Source: Minimum Number of Operations to Convert Time on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
current = "02:30", correct = "04:35"
Output
3

# Example 2

Input
current = "11:00", correct = "11:01"
Output
1

Constraints

current and correct are in the format "HH:MM"
current <= correct

Related LeetCode Problems

Practice more problems similar to Minimum Number of Operations to Convert Time.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.