双指针
Data Structures & Algorithms · 10 notes
- Remove Nth Node From End of Listhistorical
Given a linked list, remove the nth node from the end and return the head of the list. For example, given the linked list: 1->2->3->4->5, n = 2. after removing the nth node from the end, the list becomes 1->2->3->5.
- Linked List Cycle IIhistorical
Given a linked list, return the first node where the cycle begins. If the list has no cycle, return null.
- Rotate Listhistorical
Given the head head of a linked list, rotate the list to the right by k positions.
- Linked List Cycle IIhistorical
Given a linked list, return the first node where the cycle begins. If the list has no cycle, return null.
- Intersection of Two Linked Listshistorical
Write a program that finds the first node at which two singly linked lists intersect.
- Reorder Listhistorical
Reorder a singly linked list by alternating nodes from the beginning and end, changing links without modifying node values.