Available question text
Coordinate two threads—one calling foo() and the other calling bar()—so their prints strictly alternate to produce "foobar" repeated n times. The challenge is enforcing correct ordering using thread synchronization primitives (e.g., semaphores, locks/condition variables, or atomic flags).
Related questions
Continue with questions that share topics or the same question type.
- Merge Strings Alternately
Coding
- Print Binary Tree
Coding
- Print Immutable Linked List in Reverse
Coding
- Print in Order
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1115. Print FooBar Alternately
Interview date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source