McMaster Programming Challenge Solution