CTCI 7.7 find kth magic number