Next Closest Time
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
You are given a valid 24-hour time time in the form "HH:MM" (from "00:00" to "23:59").
Using only the digits that already appear in time (each digit may be reused any number of times), form the valid time that comes **soonest after** time, moving forward on the clock and wrapping past midnight if needed. If no other time can be formed, the answer is time itself, a full day later.
Return that time as "HH:MM".
Examples
Constraints
- `time.length == 5`
- `time` is a valid time in the form `"HH:MM"`
- `0 <= HH <= 23`, `0 <= MM <= 59`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.