CTCI 3.6 sort a stack