Given an integer n, return a string array answer (1-indexed) where answer[i] is "FizzBuzz" if i is divisible by both 3 and 5, "Fizz" if i is divisible by 3, "Buzz" if i is divisible by 5, and i itself written as a string otherwise.
Given an integer n, return a string array answer (1-indexed) where answer[i] is "FizzBuzz" if i is divisible by both 3 and 5, "Fizz" if i is divisible by 3, "Buzz" if i is divisible by 5, and i itself written as a string otherwise.
Example 1:
Input: {"n":3}
Output: ["1","2","Fizz"]
Constraints:
1≤n≤104
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"n":3}
Make an empty answer list and walk i from 1 to 3. Each i is tested against 3 and 5.