CodingBat code practice

## FizzBuzz Practice Code

Video

• FizzBuzz -- famous simple coding interview question
• Simple code -- a little loop and a little logic
• Idea -- experienced people can write it instantly
• Simple test for at least moderate experience
• Alternately .. weed out beginners
• Here -- a series of problems, playing on FizzBuzz themes
• Build up to something more difficult than classic FizzBuzz

Here is a little discussion and a series of live practice problems based of the famous FizzBuzz problem. FizzBuzz is a kind of famous introductory programming interview question. It's not deep or difficult; it just combines a little loop code with a little logic code. The idea is that someone with practice writing loop and logic code can write the solution out very quickly, so it makes a good first question to establish basic coding fluency. (See Constructive Advice below on this.)

## FizzBuzz Problem Statement

• Based on a traditional English children's game
• Print the numbers 1..100
• For multiples of 3, print "Fizz" instead of the number
• For multiples of 5, print "Buzz" instead of the number
• For multiples of 3 and 5, print "FizzBuzz" instead of the number
• Here: fill an array instead of printing + some other complications

So just for fun, here's a graduated series of problems that play on the same themes as FizzBuzz, working up to a slightly more complicated version of the FizzBuzz problem itself:

Basic logic:

Array structure:

Put it all together:

The FizzBuzz problem here is a little more complicated than the original, since we make you assemble the results in an array instead of just printing. We also specify arbitrary start and end numbers which enables a more interesting variety of tests.