Enforce Execution Order Across Three Threads

Asked at Zoox · Coding Questions · Difficulty: Medium

Three different threads call the methods `first`, `second` and `third` of one shared object, and the operating system may run those calls in any order. Build the object so that the three outputs always appear in the order `first`, `second`, `third`, whatever order the calls arrive in.

Loading the problem…