Practice Latest Time by Replacing Hidden Digits
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a string time in the form of hh:mm, where some of the digits in the string are hidden (represented by ?). The valid times are those inclusively between 00:00 and 23:59. Return the latest valid time you can get from time by replacing the hidden digits.
Source: Latest Time by Replacing Hidden Digits on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
time = "2?:?0"
Output
"23:50"
# Example 2
Input
time = "0?:3?"
Output
"09:39"
# Example 3
Input
time = "1?:22"
Output
"19:22"
Constraints
time is in the format hh:mm.
It is guaranteed that you can produce a valid time from the given string.
Related LeetCode Problems
Practice more problems similar to Latest Time by Replacing Hidden Digits.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.