InterviewDB Question

Print Numbers - Multithreaded Alternating Number Printer

Question Details

Problem You have two threads: EvenThread prints even numbers and OddThread prints odd numbers. They must coordinate to print numbers in order from 1 to n: 1, 2, 3, 4, ... Implement the synchronization mechanism. printNumber.run() prints the current n…

Full Details

🔒

Unlock full leaked content

Full insider details, leaked discussions, and candidate experiences.

Get Premium →

Topics

Coding Onsite Phone