Given a positive integer n, return an array of strings from 1 to n where:
"Fizz""Buzz""FizzBuzz"This is one of the most classic coding interview warm-up problems. It tests your ability to use conditional logic and the modulo operator.
n = 3["1", "2", "Fizz"]n = 5["1", "2", "Fizz", "4", "Buzz"]n = 15["1", "2", "Fizz", "4", "Buzz", "Fizz", "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz"]1 <= n <= 10^4Run your code to see results
Use Cmd+Enter to run