- Given an array of integers, swap the values based on the given conditions:
- "FizzBuzz" if int is divisible by 3 and 5.
- "Fizz" if int is divisible by 3.
- "Buzz" if int is divisible by 5.
- int (as a string) if none of the above conditions are true.
-
Example 1:
Input: [1,2,3] Output: ["1","2","Fizz"]
-
Example 2:
Input: [1,2,3,4,5] Output: ["1","2","Fizz","4","Buzz"]
-
Example 3:
Input: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] Output: ["1","2","Fizz","4","Buzz","Fizz","7","8","Fizz","Buzz","11","Fizz","13","14","FizzBuzz"]
-
You are given a method that that takes a number and returns an array of integers from 1 to the number the passed in.
-
You need to find a way to check each element in the array for the above cases add the needed value to a new String[] for each instance, and then return the String[] with the appropriate values.