Fizz Buzz Multithreaded — LeetCode 1195 Python Solution

MediumConcurrency
Problem
#1195
Reading time
2 min

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

MeasureComplexity
TimeO(n)
SpaceO(1) to O(n) auxiliary

Related problems

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.

Stuck on problems like this in a live interview?

Stealth Interview is a desktop app for macOS and Windows. It reads the problem off your screen and returns a working solution with a step-by-step explanation and its time and space complexity — invisible to screen sharing.

Get Stealth Interview