Pocket Gems interview question

A take-home assignment.