Cracking the code interview in Ruby