#18EasyThread Synchronization· Events and Signalling
Print in Order
Input format
order: permutation of [1, 2, 3], the thread start order
Output format
String: the concatenated output, which must be "firstsecondthird"
Examples
Input: order = [1, 3, 2]
Output: firstsecondthird
Thread 3 starts before thread 2, but it blocks until `second` has printed.
Input: order = [3, 2, 1]
Output: firstsecondthird
Threads start in reverse order; both waiting threads block until their predecessor signals.
Constraints
- order is a permutation of [1, 2, 3]
- Each method is called exactly once, each from its own thread.
Study first
- #concurrency
- #threads
- #synchronization
- #events
