Solution for first problem
Codify the answer