CTCI 18.9 find median