207. FizzBuzz Quest

Easy · Math

A classic with a twist! Loop from 1 to n (inclusive) and build a list: - If divisible by 3 → append 'Fizz' - If divisible by 5 → append 'Buzz' - If divisible by both → append 'FizzBuzz' - Otherwise → append the number itself

Examples

Example 1
Input: n=5
Output: [1,2,'Fizz',4,'Buzz']
Explanation: 3→Fizz, 5→Buzz

Constraints