CodeOath
← All problems

FizzBuzz

Easy
fundamentals

Write a function that returns an array/list of strings for every integer from 1 to n, where:

  • multiples of 3 become "Fizz"
  • multiples of 5 become "Buzz"
  • multiples of both become "FizzBuzz"
  • everything else becomes the number itself, as a string

Example:

Input: n = 5
Output: ["1","2","Fizz","4","Buzz"]

Constraints:

  • 1 <= n <= 10^4