1115. Print FooBar Alternately
https://leetcode.com/problems/print-foobar-alternately
Description
Suppose you are given the following code:
The same instance of FooBar
will be passed to two different threads:
thread
A
will callfoo()
, whilethread
B
will callbar()
.
Modify the given program to output "foobar"
n
times.
Example 1:
Example 2:
Constraints:
1 <= n <= 1000
ac
Last updated