solution to 2nd question