Solve question 5

Here's the solution to [question 5](http://youtu.be/DSbm-QozyDA) with tests. I hope you like it :)