Leetcode—4.双指针篇(Leetcode—4. Double pointer)

一、快慢指针

1.判定链表中是否含有环

2.已知链表中含有环,返回这个环的起始位置

3.寻找无环单链表的中点

4.寻找单链表的倒数第k个元素

二、左右指针

1.二分搜索

2.两数之和

3.反转数组

4.滑动窗口算法

————————

1、 Speed pointer

1. Determine whether the linked list contains rings

2. If it is known that the linked list contains a ring, return the starting position of the ring

3. Find the midpoint of the acyclic single linked list

4. Find the penultimate element of the single linked list

2、 Left and right pointer

1. Binary search

2. Sum of two numbers

3. Invert array

4. Sliding window algorithm