Fizz Buzz

Easy · Math & Number Theory · about 5 minutes

Asked at Bloomberg, Meta, Google, Amazon, Microsoft, Goldman Sachs, D. E. Shaw.

Return a list of strings for 1..n: "FizzBuzz" if the number is divisible by 3 and 5, "Fizz" if divisible by 3, "Buzz" if divisible by 5, and otherwise the number itself.