Solutions to Week 1 Programming Exercise