3114. Latest Time You Can Obtain After Replacing Characters

  Рет қаралды 17

CodeVia

CodeVia

3 ай бұрын

3114. Latest Time You Can Obtain After Replacing Characters #leetcodequestionandanswers #java #coding #array #greedyalgorithm #javainterviewquestions #interview #amazoninterviewpreparation #googleinterview #leetcode #javaprogramming #dsa #dsalgo #programming #hashmap java #coding #array #strings #dsa #coding
leetcode.com/problems/latest-...
You are given a string s representing a 12-hour format time where some of the digits (possibly none) are replaced with a "?".
12-hour times are formatted as "HH:MM", where HH is between 00 and 11, and MM is between 00 and 59. The earliest 12-hour time is 00:00, and the latest is 11:59.
You have to replace all the "?" characters in s with digits such that the time we obtain by the resulting string is a valid 12-hour format time and is the latest possible.
Return the resulting string.
Example 1:
Input: s = "1?:?4"
Output: "11:54"
Explanation: The latest 12-hour format time we can achieve by replacing "?" characters is "11:54".
Example 2:
Input: s = "0?:5?"
Output: "09:59"
Explanation: The latest 12-hour format time we can achieve by replacing "?" characters is "09:59".
Constraints:
s.length == 5
s[2] is equal to the character ":".
All characters except s[2] are digits or "?" characters.
The input is generated such that there is at least one time between "00:00" and "11:59" that you can obtain after replacing the "?" characters.

Пікірлер: 1
@bsrayat8200
@bsrayat8200 3 ай бұрын
Well explained!
Make The String Great - Leetcode 1544 - Python
10:53
NeetCodeIO
Рет қаралды 6 М.
How I Would Learn Java Development In 2023 (If I could start over)
9:32
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 83 МЛН
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 13 МЛН
Как бесплатно замутить iphone 15 pro max
00:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 7 МЛН
Sigma Kid Hair #funny #sigma #comedy
00:33
CRAZY GREAPA
Рет қаралды 36 МЛН
584. Find Customer Referee
4:43
Leet's Code
Рет қаралды 17
JavaScript SPREAD OPERATOR in 4 minutes! 📖
4:55
Bro Code
Рет қаралды 26 М.
Merge Strings Alternately - Leetcode 1768 - Python
4:22
NeetCodeIO
Рет қаралды 20 М.
8 Must Know JavaScript Array Methods
10:05
Web Dev Simplified
Рет қаралды 1 МЛН
3121 & 3120 Count the Number of Special Characters II & Characters I
14:54
Tricky JavaScript interview questions and answers
21:01
techsith
Рет қаралды 132 М.
Red❤️+Green💚=
00:38
ISSEI / いっせい
Рет қаралды 83 МЛН