about | help
CodingBat code practice

Code Help and Videos >

 Introduction to MakeBricks

Video

MakeBricks is a favorite CodingBat problem I created for CodingBat. It's deeper than it appears at first. I've received lots of baffled email about this problem over the years, so here I'll try to walk through how to think about it.

See also: MakeBricks Solution Code , Mod Introduction

Here's the original problem statement: We want to make a row of bricks that is goal inches long. We have a number of small bricks (1 inch each) and big bricks (5 inches each). Return true if it is possible to make the goal by choosing from the given bricks. This is a little harder than it looks and can be done without any loops.

Practice Code Problems

Here's the live MakeBricks and the slightly more difficult MakeChocolate problems:
makeBricks  makeChocolate 

(in python: make_bricks  make_chocolate )

Why Is This Hard At All? #1

Why Is This Hard At All? #2

Try the link above to give it a try.

CodingBat.com code practice. Copyright 2013 Nick Parlante.