2224. Minimum Number of Operations to Convert Time
On This Page
class Solution:
def convertTime(self, current: str, correct: str) -> int:
a = int(current[:2]) * 60 + int(current[3:])
b = int(correct[:2]) * 60 + int(correct[3:])
res, d = 0, b - a
for i in [60, 15, 5, 1]:
res += d // i
d %= i
return res