NeetCode Comprehensive Algorithm Bank & Offline Handbook
Synchronized bilingual toggle with dual NeetCode & LeetCode problem numbering and direct links. Features step-by-step logic, benchmark Python3 code, complexity analysis, interview pitfalls, and standalone offline exports.
Plus One Linked List (给单链表加一)
Given a non-negative integer represented as a linked list of digits in most significant first order, add one to it and return the ...
Print Immutable Linked List in Reverse (逆序打印不可变链表)
This is an interactive problem. You are given an immutable linked list whose nodes expose printValue() and getNext(). Print all va...
Merge In Between Linked Lists (合并两个链表)
You are given two linked lists list1 and list2, and two integers a and b. Remove the nodes of list1 from index a to index b inclus...
Merge Nodes in Between Zeros (合并零之间的节点)
You are given the head of a linked list where consecutive sequences of nodes are separated by nodes with value 0, and the list beg...
Find the Minimum and Maximum Number of Nodes Between Critical Points (找出临界点之间的最小和最大距离)
A critical point in a linked list is either a local minimum or a local maximum. Given the head of a linked list, return [minDistan...
Remove Nodes From Linked List (从链表中移除节点)
You are given the head of a linked list. Remove every node that has a node with a greater value somewhere to its right. Return the...
Reorder List (重排链表)
You are given the head of a singly linked list L0 -> L1 -> ... -> Ln. Reorder it in place to L0 -> Ln -> L1 -> L...
Maximum Twin Sum of a Linked List (链表最大孪生和)
In a linked list of even length n, the twin of node i is node n - 1 - i. The twin sum is the sum of a node and its twin. Return th...
Remove Nth Node From End of List (删除链表的倒数第 N 个结点)
Given the head of a linked list, remove the n-th node from the end and return the head. Constraints: the number of nodes is in [1,...
Delete Nodes From Linked List Present in Array (从链表中移除在数组中存在的节点)
You are given the head of a linked list containing unique integers and an array nums. Remove all nodes whose value appears in nums...
Swapping Nodes in a Linked List (交换链表中的节点)
You are given the head of a linked list and an integer k. Swap the values of the k-th node from the beginning and the k-th node fr...
Copy List with Random Pointer (复制带随机指针的链表)
A linked list has nodes with an extra random pointer that may point to any node or None. Return a deep copy of the list: new nodes...
Design Linked List (设计链表)
Design a linked list supporting get(index), addAtHead(val), addAtTail(val), addAtIndex(index, val) and deleteAtIndex(index). get r...
Design Browser History (设计浏览器历史记录)
Design a browser history supporting visit(url) (clears the forward history), back(steps) and forward(steps), both returning the cu...
Add Two Numbers (两数相加)
You are given two non-empty linked lists representing two non-negative integers in reverse order (least significant digit first). ...
Add Two Numbers II (两数相加 II)
You are given two non-empty linked lists representing two non-negative integers in most significant first order. Add the two numbe...
Find the Duplicate Number (寻找重复数)
Given an array nums of n + 1 integers where each value is in [1, n], exactly one value is repeated (possibly more than twice). Fin...
Swap Nodes in Pairs (两两交换链表中的节点)
Given a linked list, swap every two adjacent nodes and return its head. You must not modify the values in the nodes, only the node...
Sort List (排序链表)
Given the head of a linked list, sort it in ascending order and return the head. Constraints: the number of nodes is in [0, 5 * 10...
Partition List (分隔链表)
Given the head of a linked list and a value x, partition it so that all nodes with values less than x come before nodes with value...
Rotate List (旋转链表)
Given the head of a linked list, rotate it to the right by k places and return the head. Constraints: the number of nodes is in [0...
Reverse Linked List II (反转链表 II)
Given the head of a linked list and two integers left and right with left <= right, reverse the nodes from position left to pos...
Design Circular Queue (设计循环队列)
Design a circular queue with a fixed capacity k, supporting enQueue(value), deQueue(), Front(), Rear(), isEmpty() and isFull(). Re...
Insertion Sort List (对链表进行插入排序)
Given the head of a singly linked list, sort it using insertion sort and return the head. The steps of the insertion sort must be ...