改进到O(n)

  1. hash table
  2. bit manipulation
  3. two pointers(i,j在首,或者i, j 一头一尾)
  4. dp 或者greedy

见gas station https://leetcode.com/problems/gas-station/. 不需要 在i ==0不满足条件之后,继续试探i == 1, 试探i == k + 1即可

改进到O(nlogn)

  1. binary search
  2. sort