1. Fizz Buzz

Difficulty: 

FizzBuzz is the "Hello World" of technical interview questions. Your function should write the numbers from 1 to n with a twist; instead of any multiplier of 3, you output Fizz, instead of multiplers of 5 you output Buzz, and if they happen at the same time, you should use FizzBuzz. The output of your function should be a mixed array of numbers and strings.

Input:

fizzbuzz(20);

Output:

[
  1,
  2,
  "Fizz",
  4,
  "Buzz",
  "Fizz",
  7,
  8,
  "Fizz",
  "Buzz",
  11,
  "Fizz",
  13,
  14,
  "FizzBuzz",
  16,
  17,
  "Fizz",
  19,
  "Buzz"
]

Time Limit:

1000 (ms)

Hints (hover to see):

  • Hint #1
  • Hint #2



Results

ProblemsAcceptedWrongTimed OutError
80000

Input:

Expected Output:

Output: