HW3 solution