Description
Solutions
Submission
Maximum Time
🤘 INTERN

You are given a string that represents time in the format hh:mm. Some of the digits are blank (represented by ?). Fill in ? such that the time represented by this string is the maximum possible. Maximum time: 23:59, minimum time: 00:00. You can assume that input string is always valid.

Example 1:

Input:  time = "?4:5?"
Output: "14:59"
Explanation:
Provided by Groot for reference (May not be 100% accurate 👉👈) - Replace the first '?' with '1' to make the hour as large as possible, which is '14'. The last '?' is replaced with '9' to make the minutes as large as possible, resulting in "14:59".

Example 2:

Input:  time = "23:5?"
Output: "23:59"
Explanation:
Provided by Groot for reference (May not be 100% accurate 👉👈) - The hour is already at its maximum, '23'. Replace the last '?' with '9' to make the minutes as large as possible, resulting in "23:59".

Example 3:

Input:  time = "?2:22"
Output: "23:22"
Explanation:
Provided by Groot for reference (May not be 100% accurate 👉👈) - Replace the first '?' with '2' to make the hour as large as possible, which is '23'. The minutes are already given, so the final time is "23:22".

Example 4:

Input:  time = "0?:??"
Output: "09:59"
Explanation:
Provided by Groot for reference (May not be 100% accurate 👉👈) - Replace the second '?' with '9' to make the hour as large as possible, which is '09'. Replace the last two '?'s with '59' to make the minutes as large as possible, resulting in "09:59".

Example 5:

Input:  time = "??:??"
Output: "23:59"
Explanation:
Provided by Groot for reference (May not be 100% accurate 👉👈) - Replace the first '?' with '2' and the second '?' with '3' to make the hour as large as possible, which is '23'. Replace the last two '?'s with '59' to make the minutes as large as possible, resulting in "23:59".
Constraints:
    Unknown yet. If u happen to know about it feel free to lmk. tysm! ~^~
Thumbnail 0
Testcase

Result
Case 1

input:

output: