CTCI exercise 1.1, 1.2