Tap here to switch tabs
Problem
Submissions

Problem: Fizz Buzz

med
30 min
Try to solve the Fizz Buzz problem.

Statement

Given an integer n, return a string array answer where answer[i] is the string representation of the integer i + 1 for each i from 00 to n - 1, except:

If i + 1 is divisible by both 33 and 55, answer[i] should be "FizzBuzz".
If i + 1 is divisible by 33 but not $5, answer[i] should be "Fizz".
If i + 1 is divisible by 55 but not $3, answer[i] should be "Buzz".

Return answer.

Constraints:

  • 1≤1 \leq n ≤104\leq 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Fizz Buzz

med
30 min
Try to solve the Fizz Buzz problem.

Statement

Given an integer n, return a string array answer where answer[i] is the string representation of the integer i + 1 for each i from 00 to n - 1, except:

If i + 1 is divisible by both 33 and 55, answer[i] should be "FizzBuzz".
If i + 1 is divisible by 33 but not $5, answer[i] should be "Fizz".
If i + 1 is divisible by 55 but not $3, answer[i] should be "Buzz".

Return answer.

Constraints:

  • 1≤1 \leq n ≤104\leq 10^4