Easy
FizzBuzz
Easy
262 submissions
10 coins
+50 XP
Math
Simulation
String
Problem Description
Return a list of strings for the numbers `1` to `n`. For multiples of both 3 and 5 use `"FizzBuzz"`, for multiples of 3 only use `"Fizz"`, for multiples of 5 only use `"Buzz"`, otherwise use the number itself as a string.
**Example 1:**
```
Input: n = 3
Output: ["1", "2", "Fizz"]
```
**Example 2:**
```
Input: n = 5
Output: ["1", "2", "Fizz", "4", "Buzz"]
```
**Example 3:**
```
Input: n = 15
Output: ["1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz"]
```
Constraints
- `1 <= n <= 10^4`
Need help?
Connect with expert programmers for real-time collaborative coding, video meetings, and whiteboard sessions via CodeConnect.
Video Call
Whiteboard
Live Coding
Screen Share