改进到O(n)
hash table
bit manipulation
two pointers(i,j在首,或者i, j 一头一尾)
dp 或者greedy
见gas station https://leetcode.com/problems/gas-station/. 不需要 在i ==0不满足条件之后,继续试探i == 1, 试探i == k + 1即可
改进到O(nlogn)
binary search
sort
hash table
bit manipulation
two pointers(i,j在首,或者i, j 一头一尾)
dp 或者greedy
见gas station https://leetcode.com/problems/gas-station/. 不需要 在i ==0不满足条件之后,继续试探i == 1, 试探i == k + 1即可
binary search
sort