how to approach binary search problem

tags: learning leetcode programming

content

  1. think about the range for the binary search (left and right pointers)
  2. what’s the criteria for moving pointers
  3. when moving pointers, should i discard mid
  4. bounds:
    • while left < right vs while left <= right
    • when to use which? what’s the meaning behind these two?
      • while left < right: left and right converges; when loop breaks, left == right

up

down

reference