spoj books1

Question link: here

How can I apply Binary search in this question as stated by some person…

please give solution or explanation.please…

2 Likes

Go through the following article on binary search:

http://help.topcoder.com/data-science/competing-in-algorithm-challenges/algorithm-tutorials/binary-search/

If you have a fair idea of what binary search is, and can implement it, then it won’t take long. There is an example given at the end of the article cited above, which is similar to the problem you have linked.

P.S. The article is awesome. If you know the basics of binary search, you can skip the first half. I would suggest that you read the whole article. If you know it, it won’t take long, otherwise you may have learned something unexpected. It gives you a new perspective to look at problems that can be solved using binary search. Read through other Topcoder algorithm tutorials, if you want to.

4 Likes

Thanks a lot.

gotcha.