Code Help and Videos >
MakeBricks is a favorite problem I created for CodingBat, probably because it has more depth than it appears at first. Here I'll walk through one way to solve it.
See also: MakeBricks Introduction , Mod Introduction
Here's the live MakeBricks and the slightly more difficult MakeChocolate problems:
(in python: make_bricks make_chocolate )
goal % 5
Sometimes a problem appears to be a baffling tangle. Often, if you slow down, you can break it down to 2 or 3 cases, and then solve them one at a time. "Divide and Conquer" as Caesar said, and that's what's going on here, focussing on one aspect of the problem at a time.
CodingBat.com code practice. Copyright 2013 Nick Parlante.