Add a solution to the problem 85
Optimize the solution