week 6 solutions by chenhao