LeetCode常见题型——双指针

1. 算法思想

双指针主要用于遍历数组,协同完成任务,也可延伸到多数组多指针。

若双指针指向同一数组,遍历方向相同且不会相交,则为滑动窗口,常用于区间搜索。

若双指针只想同一数组,但遍历方向相反,则可用来搜索排好序的数组。

C++指针尤为重要,可以有很多特别的操作。

2. 常见题型

LeetCode-1. Two Sum [C++]_贫道绝缘子的博客-CSDN博客Given an array of integers, returnindicesof the two numbers such that they add up to a specific target.https://blog.csdn.net/qq_15711195/article/details/122143418LeetCode-167. Two Sum II - Input Array Is Sorted [C++][Java]_贫道绝缘子的博客-CSDN博客Given a1-indexedarray of integersnumbersthat is alreadysorted in non-decreasing order, find two numbers such that they add up to a specifictargetnumber.https://blog.csdn.net/qq_15711195/article/details/122995459LeetCode-88. Merge Sorted Array [C++][Java]_贫道绝缘子的博客-CSDN博客You are given two integer arraysnums1andnums2, sorted innon-decreasing order, and two integersmandn, representing the number of elements innums1andnums2respectively. Mergenums1andnums2into a single array sorted innon-decreasing order.https://blog.csdn.net/qq_15711195/article/details/123011151LeetCode-141. Linked List Cycle [C++][Java]_贫道绝缘子的博客-CSDN博客Givenhead, the head of a linked list, determine if the linked list has a cycle in it.https://blog.csdn.net/qq_15711195/article/details/122519333?spm=1001.2014.3001.5502LeetCode-142. Linked List Cycle II [C++][Java]_贫道绝缘子的博客-CSDN博客Given theheadof a linked list, returnthe node where the cycle begins. If there is no cycle, returnnull.https://blog.csdn.net/qq_15711195/article/details/122519693LeetCode-76. Minimum Window Substring [C++][Java]_贫道绝缘子的博客-CSDN博客Given two stringssandtof lengthsmandnrespectively, returntheminimum window substringofssuch that every character int(including duplicates) is included in the window.https://blog.csdn.net/qq_15711195/article/details/122852073?spm=1001.2014.3001.5502LeetCode-633. Sum of Square Numbers [C++][Java]_贫道绝缘子的博客-CSDN博客Given a non-negative integerc, decide whether there're two integersaandbsuch thata2+ b2= c.https://blog.csdn.net/qq_15711195/article/details/123011466LeetCode-5. Longest Palindromic Substring [C++][Java]_贫道绝缘子的博客-CSDN博客Given a strings, returnthe longest palindromic substringins.https://blog.csdn.net/qq_15711195/article/details/122833115LeetCode-680. Valid Palindrome II [C++][Java]_贫道绝缘子的博客-CSDN博客Given a strings, returntrueif thescan be palindrome after deletingat most onecharacter from it.https://blog.csdn.net/qq_15711195/article/details/123011663LeetCode-524. Longest Word in Dictionary through Deleting [C++][Java]_贫道绝缘子的博客-CSDN博客Given a stringsand a string arraydictionary, returnthe longest string in the dictionary that can be formed by deleting some of the given string characters. If there is more than one possible result, return the longest word with the smallest lexicographhttps://blog.csdn.net/qq_15711195/article/details/123012002LeetCode-340. Longest Substring with At Most K Distinct Characters [C++][Java]_贫道绝缘子的博客-CSDN博客Given a string, find the length of the longest substring T that contains at mostkdistinct characters.https://blog.csdn.net/qq_15711195/article/details/123012183LeetCode-3. Longest Substring Without Repeating Characters [C++][Java]_贫道绝缘子的博客-CSDN博客Given a strings, find the length of thelongest substringwithout repeating characters.https://blog.csdn.net/qq_15711195/article/details/122817429?spm=1001.2014.3001.5502

参考文献

【1】C/C++指针详解之基础篇

【2】C/C++指针详解之提高篇

【3】C/C++函数指针与指针函数等区别

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

贫道绝缘子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值