FizzBuzz

Medium20–30 pts depending on language · +25 for learning a language that's new to you

Count from 1 to n and return every step as text in a list. For multiples of 3, use Fizz instead of the number. For multiples of 5, use Buzz. For multiples of both 3 and 5, use FizzBuzz.

fizzBuzz(5) returns ["1", "2", "Fizz", "4", "Buzz"].

n is between 1 and 100.

Examples

Input: fizzBuzz(5)

Output: ["1", "2", "Fizz", "4", "Buzz"]

Input: fizzBuzz(15)

Output: ["1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz"]

Your solution is checked against 2 example tests and 4 hidden tests (edge cases and bigger inputs).

Solved by 7 members

  1. 1RainePython 3 · Oct 12
  2. 2CasonRust · Oct 13
  3. 3Alex T.Rust · Oct 13
  4. 4brett B.C · Oct 14
  5. 5Isaac M.Python 3 · Oct 14
Full leaderboard →

Your Solution

Languages you don't learn in class are worth more: C++ 1.25×, JavaScript, TypeScript, C, Rust and Go 1.5×. Your first solve in a language unlocks its "Learned" achievement: +25 for learning it.

Loading editor...

IntelliSense: connecting…

Run Code checks the example tests. Submit runs every test, including hidden ones.