week 7 solutions by chenhao