Back to writing

Binary search: the real challenge is monotonicity and boundary design

Binary search is not mainly about a loop template.

Binary search is not mainly about a loop template.

It depends on:

  • whether the answer space has monotonicity
  • whether you know which boundary you are looking for