Fizz Buzz
STRING
ARRAY
Problem
Given an integer n
, return a string array answer where:
- answer[i] == "Coden" if i is divisible by 3.
- answer[i] == "Quest" if i is divisible by 5.
- answer[i] == "CodenQuest" if i is divisible by both 3 and 5.
- answer[i] == i (as a string) for all other numbers.
Examples
fizzBuzz(4) // returns ["1","2","Coden","4"] fizzBuzz(7) // returns ["1","2","Coden","4","Quest","Coden","7"]
Loading...