模板:
for (int i = 0, j = 0; i < n; i++) {
while (j < (i) && check(i, j)) j++;
//题目的具体逻辑
}
核心思想:
先把暴力的解法写出来,看是否有单调性,若有则可用双指针
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
//O(n^2)
//将上面的朴素算法优化到O(n)
题目:
标签:题目,++,int,题库,指针,AcWing From: https://www.cnblogs.com/-37-/p/17661135.html