week 9 solutions by chenhao