CTCI 11.8 get rank of number