Reported September 2026
Amazonsimulation

Next Palindromic Time

Reported by candidates from Amazon's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Amazon OA. Under 2s to a working solution.
Founder's read

The mistake that sinks a first attempt on this Amazon question, reported in September 2026, is returning the input time when it's already a palindrome. The prompt says strictly later, and that one word fails the edge case. The task is simple: given HH:MM, find the next time whose four digits read the same both ways, wrapping past 23:59. It's a simulation problem with a tiny search space. You can brute force it in under 1440 steps. If you blank during the live OA, StealthCoder runs invisibly on your desktop as a safety net, so one missed detail doesn't cost you the round.

The problem

Given a valid 24-hour time time in HH:MM format, return the first strictly later time whose four digits form a palindrome.
Advance in one-minute steps and wrap from 23:59 to 00:00. The input itself is never returned unless a full day has elapsed.

Function
nextPalindromicTime(time: String) → String

Examples
Example 1
time = "12:21"
return = "13:31"
13:31 is the first later valid time whose digits read the same in both directions.
Example 2
time = "23:32"
return = "00:00"
No later palindromic time remains that day, so the search wraps to midnight.
Example 3
time = "05:50"
return = "10:01"
The next palindromic four-digit clock value after 0550 is 1001.

Constraints
time.length == 5.
time[2] == ':'.
time is a valid zero-padded 24-hour time from 00:00 through 23:59.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is that you don't need cleverness. Convert the time to total minutes, then loop from 1 to 1440. At each step compute (start + i) % 1440, turn it back into hours and minutes, and check whether the digits h1 h2 m1 m2 satisfy h1 == m2 and h2 == m1. Return the first hit. Starting the loop at 1 handles the strictly later rule. Running to 1440 covers the case where the input is the only palindrome you'd ever see, which comes back after a full day. That case can't really occur here, since many palindromic times exist, but the loop bound is still correct. Pitfalls: forgetting zero-padding on output, so 0:00 prints wrong, and checking only the hour string against its reverse. Also don't forget the wrap like 23:32 to 00:00. If the live assessment rattles you, StealthCoder can supply this loop in real time as a hedge.

Memorize the pattern. If you can't, run StealthCoder. The proctor sees the IDE. They don't see what's behind it.

If this hits your live OA

You can drill Next Palindromic Time cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Amazon's OA.

Amazon reuses patterns across OAs. Made by an engineer who treats the OA as theater. If yours is tonight, you don't have time to grind. You have time to hedge. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Next Palindromic Time FAQ

How hard is Next Palindromic Time really?+

Easy. The search space is at most 1440 minutes, so brute force passes. The difficulty is in the details: strictly later, midnight wrap, and zero-padded output. Candidates fail on those, not on the algorithm.

What's the trick to solve it fast?+

Convert to minutes since midnight, loop i from 1 to 1440, take (start + i) % 1440, format as HH:MM, and check that the four digits form a palindrome. Return on the first match. No math tricks are needed.

Should I return the input if it's already a palindrome?+

No. The problem says strictly later. For 12:21 the answer is 13:31, not 12:21. Start your loop at one minute ahead so the input never matches itself, unless a full day passes.

How do I handle the wrap from 23:59 to 00:00?+

Use modulo 1440 on the total minutes. Then hours are minutes divided by 60 and minutes are the remainder. Example 2 shows 23:32 giving 00:00, which comes out naturally from the modulo with no special case.

How do I prepare for this in 48 hours?+

Write the loop once from scratch and test the three given examples. Then add edge cases like 23:59, 00:00, and 09:59. Practice zero-padded formatting in your language, since that's where silent bugs show up.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Amazon.

OA at Amazon?
Invisible during screen share
Get it