Solved first problem
Comment on time complexity