2224. Minimum Number of Operations to Convert Time

  Рет қаралды 18

CodeVia

CodeVia

Күн бұрын

2224. Minimum Number of Operations to Convert Time #leetcodequestionandanswers #java #coding #array #greedyalgorithm #javainterviewquestions #interview #amazoninterviewpreparation #googleinterview #leetcode #javaprogramming #dsa #dsalgo #programming #hashmap java #coding #array #strings #dsa #coding #2darray
leetcode.com/problems/minimum...
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.

Пікірлер
Nature's Incredible ROTATING MOTOR (It’s Electric!) - Smarter Every Day 300
29:37
Как бесплатно замутить iphone 15 pro max
00:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 7 МЛН
Cool Items! New Gadgets, Smart Appliances 🌟 By 123 GO! House
00:18
123 GO! HOUSE
Рет қаралды 17 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 14 МЛН
CHATGPT DOESN'T REASON! (Top scientist bombshell)
1:42:28
Machine Learning Street Talk
Рет қаралды 1,4 М.
Daily Leetcode challenge 🔥| Sort the People | In just 5 mins
4:56
VICKY KAUSHAL REACTS TO VICKY KAUSHAL MEMES ft. VICKY KAUSHAL
26:42
Tanmay Bhat
Рет қаралды 7 МЛН
Object Oriented Programming (OOP) in C++ Course
1:30:26
freeCodeCamp.org
Рет қаралды 2,5 МЛН
Как бесплатно замутить iphone 15 pro max
00:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 7 МЛН