Skip to interview prep
Apexed

4. FizzBuzz

EasyWarm-up

Return a list of strings for the numbers 1 to n. For multiples of 3 use "Fizz", for multiples of 5 use "Buzz", for multiples of both use "FizzBuzz", and otherwise use the number as a string.

Example 1

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

Constraints

  • 1 ≤ n ≤ 10⁴

Tab indents · Ctrl/⌘ + Enter runs · Esc then Tab leaves the editor

Run checks these cases; the expected output comes from the reference solution. Submit judges all 3 hidden and sample tests.

Code runs only in your browser in an isolated sandbox. Progress and submissions are saved on this device.

FizzBuzz — coding interview practice — Apexed