Adding solution to first problem