Python3 Solution using 5 primitives (lock, semaphore, condition, event, barrier)
Approach \#1. Lock\n- RLock is not suitable in this case. \n\n\n\n# Approach \#2. Semaphore\n- Semaphore(1) is equivalent to Lock()\n\n\n# Approach \#3. Conditi
# Approach \\#1. Lock\n- `RLock` is not suitable in this case. \n\n<iframe src="https://leetcode.com/playground/mgRcT2DB/shared" frameBorder="0" width="600" height="400"></iframe>\n\n# Approach \\#2. Semaphore\n- `Semaphore(1)` is equivalent to `Lock()`\n<iframe src="https://leetcode.com/playground/c4bkiTBr/shared" frameBorder="0" width="600" height="400"></iframe>\n\n# Approach \\#3. Condition\n<iframe src="https://leetcode.com/playground/Z2up2An3/shared" frameBorder="0" width="600" height="500"></iframe>\n\n# Approach \\#4. Event \n<iframe src="https://leetcode.com/playground/hTnE2h6z/shared" frameBorder="0" width="600" height="400"></iframe>\n\n# Approach \\#5. Barrier\n<iframe src="https://leetcode.com/playground/RxQpksKT/shared" frameBorder="0" width="600" height="400"></iframe>\n
['Concurrency', 'Python3']