kotlin-coding-challenges

FizzBuzz

Instructions

Given positive integer n implement a function which returns a list numbers from 1 to n. However for multiples of three list should contain word Fizz instead of the number and for the multiples of five list should contain word Buzz. For numbers which are multiples of both three and five list should contain FizzBuzz word.

Challenge Solution

Examples

fizzBuzz(5) // [1, 2, "Fizz", 4, "Buzz"]

fizzBuzz(16) // [1, 2, "Fizz", 4, "Buzz", "Fizz", 7, 8, "Fizz", "Buzz", 11, "Fizz", 13, 14, "FizzBuzz", 16]