solution to the final problem set