Fizz Buzz

Asked atAmazon
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
  1. 01Iterate from one through n.
  2. 02Test divisibility by both factors first.
  3. 03Then test each individual factor.
  4. 04Otherwise emit the number.
  5. 05Validate boundary and ordering behavior.

Reference answer

Then expect these follow-ups

  • How would you generalize this to configurable rules?

    Tests: follow-up reasoning

  • What tests catch branch-order bugs?

    Tests: follow-up reasoning

Free to read · better with Enzo

Practice this out loud with Enzo

Enzo runs it as a mock interview, pushes back with follow-ups, and grades you on the rubric.

Next question