MediumNo. 1195
Fizz Buzz Multithreaded — LeetCode 1195 Python Solution
- Topics
- Concurrency
- Reading time
- 2 min
- Source
- leetcode.com
The problem
You have the four functions: printFizz that prints the word "fizz" to the console, printBuzz that prints the word "buzz" to the console, printFizzBuzz that prints the word "fizzbuzz" to the console, and printNumber that prints a given integer to the console. You are given an instance of the class FizzBuzz that has four functions: fizz, buzz, fizzbuzz and number.
Example
- Input
- n = 15
- Output
- [1,2,"fizz",4,"buzz","fizz",7,8,"fizz","buzz",11,"fizz",13,14,"fizzbuzz"]
Complexity
- Time
- O(n)
- Space · auxiliary
- O(1) to O(n)
Related problems
| No. | Problem | Difficulty |
|---|---|---|
| 0412 | Fizz Buzz | Easy |
| 1114 | Print in Order | Easy |
| 1115 | Print FooBar Alternately | Medium |
| 1116 | Print Zero Even Odd | Medium |
| 1117 | Building H2O | Medium |
| 0057 | Insert Interval | Medium |
Frequently asked questions
- How hard is LeetCode 1195. Fizz Buzz Multithreaded?
LeetCode 1195. Fizz Buzz Multithreaded is rated Medium on LeetCode.
- What topics does LeetCode 1195. Fizz Buzz Multithreaded cover?
LeetCode 1195. Fizz Buzz Multithreaded is tagged Concurrency on LeetCode.