Print in Order
A easy-tier problem at 72% community acceptance, tagged with Concurrency. Reported in interviews at Nvidia and 0 others.
Print in Order is a concurrency problem that trips up candidates who've never had to synchronize threads. Nvidia asks it, and the 71% acceptance rate masks a real pattern: people who haven't touched mutex or semaphore constructs in years suddenly have to reason about thread safety under time pressure. This isn't a data-structure grind. It's about understanding how to force one thread to wait for another without burning CPU. If you hit this live and blank on the synchronization primitive, StealthCoder surfaces a working solution invisible to the proctor in seconds.
Companies that ask "Print in Order"
Print in Order is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.
Get StealthCoderThe trick is forcing print order across multiple threads without a mess. The naive approach is spin-waiting in a loop, checking a flag. That works but wastes cycles. The real pattern uses a synchronization primitive (mutex, semaphore, or conditional variable depending on your language) to block threads until their turn arrives. Most candidates struggle because they either over-lock (locking too much, killing parallelism) or under-lock (race conditions on the flag check). The pattern is: each thread waits on a condition until a shared counter or flag says it's safe to print, then prints, updates the state, and signals the next thread. If you freeze during the OA and can't remember the exact syntax for your language's threading library, StealthCoder reads your code, identifies the pattern mismatch, and delivers a correct implementation fast.
Pattern tags
You know the problem.
Make sure you actually pass it.
Print in Order recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Print in Order interview FAQ
Is Print in Order actually asked in real interviews or just practice sites?+
Nvidia includes it in their assessment pipeline. The 71% pass rate suggests most candidates who prepare see it coming. But that also means if it shows up cold and you haven't drilled concurrency recently, you're at a real disadvantage compared to the prepared cohort.
What's the difference between using a mutex, semaphore, or condition variable here?+
All three work. Mutex plus a flag is simplest. Semaphore is cleaner if your language has it well-supported. Condition variable is overkill but safe. Pick one, implement it correctly, and move on. The interviewer cares that you know threading exists and can use it, not which tool you chose.
Will busy-waiting or spin-locking pass, or do I need a true blocking call?+
Spin-locking passes functionally but signals you don't understand concurrency deeply. Blocking (mutex.lock() or semaphore.wait()) shows you know the right tool. In an assessment, either usually passes. In a follow-up, they'll ask why one is better.
How much do I need to know about concurrency to get this right?+
You need to know your language's threading API at surface level. Mutex syntax, how to acquire and release, how to signal or notify. If you've written a simple thread-safe counter before, you're ready. If threading is totally new, this problem feels harder than it is.
Does Print in Order require any fancy algorithms or is it pure threading mechanics?+
Pure threading mechanics. No algorithms. The hard part isn't the pattern. It's writing the synchronization correctly without deadlock. Once you have the right primitive, the solution is straightforward.
Want the actual problem statement? View "Print in Order" on LeetCode →