Tap here to switch tabs
Problem
Submissions

Problem: Latest Time You Can Obtain After Replacing Characters

med
30 min
Try to solve the Latest Time You Can Obtain After Replacing Characters problem.

Statement

You are given a string s of length 55 representing a 1212 hour time format where some digits are replaced by the character "?". A valid time format ranges from "00:00" to "11:59".

Return the latest valid 1212 hour time that can be obtained by replacing all instances of "?" with digits.

Constraints:

  • s.length =5= 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 11 time between "00:00" and "11:59" that can be obtained after replacing the "?" characters

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Latest Time You Can Obtain After Replacing Characters

med
30 min
Try to solve the Latest Time You Can Obtain After Replacing Characters problem.

Statement

You are given a string s of length 55 representing a 1212 hour time format where some digits are replaced by the character "?". A valid time format ranges from "00:00" to "11:59".

Return the latest valid 1212 hour time that can be obtained by replacing all instances of "?" with digits.

Constraints:

  • s.length =5= 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 11 time between "00:00" and "11:59" that can be obtained after replacing the "?" characters