← Challenges

FizzBuzz List

Write solve(n) that returns a list of strings for the numbers 1 to n (inclusive): "Fizz" for multiples of 3, "Buzz" for multiples of 5, "FizzBuzz" for multiples of both, otherwise the number as a string.

Examples

  • solve(5)["1","2","Fizz","4","Buzz"]
  • solve(3)["1","2","Fizz"]