Minimum Number of Operations to Convert Time LeetCode solution in Python
1class Solution:2def convertTime(self, current: str, correct: str) -> int:3def get_time(t):4hh, mm = t.split(":")5return int(hh) * 60 + int(mm)67current, correct = get_time(current), get_time(correct)8operations = 09diff = correct - current1011for mins in [60, 15, 5, 1]:12quotient, remainder = divmod(diff, mins)13operations += quotient14diff = remainder1516return operations