how to approach this problem

algorithm
binary-search

#1