摘要:
双指针 对于一个序列,用两个指针维护一段区间; 对于两个序列,维护某种次序,比如归并排序中合并两个有序序列的操作; for(int i = 0, j = 0; j < n; j++) { //当前维护的区间不满足条件,i向前移动到满足条件 while(i < j && check(i, j)) i+ 阅读全文 »
posted @ 2020-08-23 16:56
NaughtyCoder
阅读(113)
评论(0)
推荐(0)
发表于 2020-08-23 15:03阅读次数:112评论次数:0
摘要:
在排序数组中查找数字 题目链接:https://leetcode-cn.com/problems/zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof/ class Solution { public: int search(vector<int>& nums, 阅读全文 »
posted @ 2020-08-23 15:03
NaughtyCoder
阅读(112)
评论(0)
推荐(0)