Solution to CTCI 9.6
Solution to CTCI 9.7