Created
November 21, 2016 05:50
-
-
Save tk0221/c0f613a7a40aa78946f11c9667077618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @param {Integer} n | |
# @return {String[]} | |
def fizz_buzz(n) | |
tmp = [] | |
(1..n).each do |i| | |
tmp.push("FizzBuzz") && next if i % 15 == 0 | |
tmp.push("Fizz") && next if i % 3 == 0 | |
tmp.push("Buzz") && next if i % 5 == 0 | |
tmp.push(i.to_s) | |
end | |
return tmp | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
112ms