Hacker News new | ask | show | jobs
by philcrissman 1918 days ago
I was actually asked Fizz Buzz in an interview once, but I did not have this solution at the time.

My favorite FizzBuzz solution is actually:

``` ->(n){[[["Fizz"][n%3],["Buzz"][n%5]].join].find(->{n}){|w| w if !w.empty?}} ```

This is Ruby, of course, probably something very similar can be done in several other languages.