Second solution to the problem

Also adding benchmark module to measure the execution time. Pretty nifty
of Ruby