Solve question 50

Here's a not very interesting algorithm.