Leetcode 1116. Print Zero Even Odd
Coordinate three threads—zero(), even(), and odd()—to print the interleaved sequence "0 1 0 2 0 3 ..." up to n (total length 2n), ensuring zeros and numbers strictly alternate and only the correct odd/even thread prints its number when it's their turn.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.