Uploading solution for Problem 2