Solved the first problem
Solved problem 2