刷题 - 双指针

参考https://github.com/CyC2018/CS-Notes/blob/master/notes/Leetcode%20%E9%A2%98%E8%A7%A3%20-%20%E7%9B%AE%E5%BD%95.md

双指针部分:

  • 1. 有序数组的 Two Sum

https://leetcode-cn.com/problems/two-sum-ii-input-array-is-sorted/

  • 2. 两数平方和

https://leetcode-cn.com/problems/sum-of-square-numbers/
(注意双指针p取0开始,条件p<=q)

  • 3. 反转字符串中的元音字符

https://leetcode-cn.com/problems/reverse-vowels-of-a-string/

(注意改变字符串不会影响原值,要改成引用类型如数组)

  • 4. 回文字符串

https://leetcode-cn.com/problems/valid-palindrome-ii
(一定要注意循环终止条件)

  • 5. 归并两个有序数组

https://leetcode-cn.com/problems/merge-sorted-array/
(条件!条件!)

  • 6. 判断链表是否存在环
    https://leetcode-cn.com/problems/linked-list-cycle/
    (复杂度分析)

  • 7. 最长子序列

https://leetcode-cn.com/problems/longest-word-in-dictionary-through-deleting/
(注意审题:字典顺序最小,可以先比较首字母小了再检查)

你可能感兴趣的:(刷题 - 双指针)