This is the exercise for book Cracking the Coding Interview