Source Code for the HP Challenge Solution