Uploading solution to Problem 2