cswork / libraryOpen practice workspace

Interview experiences · Arize

Arize Software Engineer Interview Experience — Three Threads Printing 0 Through n in Order

Tech screenInterviewed 2026-08

Sharing an interview from a less commonly discussed company. The problem was to have multiple threads print the numbers from 0 through n in alternating turns. Given a number n, three specified threads must cooperate to print every number from 0 through n in order. The output must also identify which thread printed each number. The thread responsibilities were: ZeroThread prints 0, and 0 can be pr…

Sharing an interview from a less commonly discussed company.

The problem was to have multiple threads print the numbers from 0 through n in alternating turns.

Given a number n, three specified threads must cooperate to print every number from 0 through n in order. The output must also identify which thread printed each number.

The thread responsibilities were:

  1. ZeroThread prints 0, and 0 can be printed only once.
  2. OddThread prints all odd numbers: 1, 3, 5, 7, and so on.
  3. EvenThread prints all even numbers: 2, 4, 6, 8, and so on.

The required output format was:

0 printed by ZeroThread
1 printed by OddThread
2 printed by EvenThread
3 printed by OddThread
4 printed by EvenThread
...
n printed by respective thread

The design constraints were:

  1. Implement three independent thread classes: ZeroThread, OddThread, and EvenThread.
  2. Keep the printing logic inside the corresponding thread class. For example, the logic for printing 0 belongs in ZeroThread, the odd-number logic belongs in OddThread, and the even-number logic belongs in EvenThread.
  3. The printed numbers must remain in strictly increasing order.

Comments

Nothing here yet.

Join in on CSWork →