Problem solution on the book <Think Complexity>