Fizz Buzz Problem
Fizz Buzz Problem — ExecCode School DSA Practice
Solve the Fizz Buzz problem on ExecCode. Free online school DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Given an integer n, return a string array answer (1-indexed) where answer[i] is "FizzBuzz" if i is divisible by 3 and 5, "Fizz" if divisible by 3, "Buzz" if divisible by 5, otherwise i as a string.
Examples
Input n = 5; Output ["1", "2", "Fizz", "4", "Buzz"]
Constraints
1 ≤ n ≤ 10^4
Practice Fizz Buzz free on ExecCode. Browse DSA problems, topic map, and placement guides.