Solving a little brain-teaser from the FogCreek folks.