Linked List
Linked List
Sixty questions on singly and doubly linked lists — reversal, cycle detection, merging, and in-place manipulation.
Linked List Cycle Detection
easyDetermine whether a singly-linked list loops back on itself instead of ending in null.
Merge Two Sorted Linked Lists
easySplice two sorted singly-linked lists together into a single sorted list.
Middle of the Linked List
easyFind the value stored in the middle node of a singly-linked list in a single pass.
Minimum Pair Removal to Sort Array I
easyGiven an array nums, you can perform the following operation any number of times: Return the minimum number of operations needed to make the array non-decreasing.
Palindrome Linked List
easyCheck whether the values in a singly-linked list read the same forwards and backwards.
Remove Duplicates From a Sorted Linked List
easyCollapse consecutive duplicate values in a sorted singly-linked list so each value appears once.
Remove Linked List Elements
easyDelete every node in a singly-linked list whose value matches a given target.
Reverse a Linked List
easyReverse a singly-linked list in place and return the reversed list.
Add Two Numbers as Linked Lists
mediumAdd two non-negative integers stored as reverse-order digit linked lists and return the sum in the same format.
Odd-Even Linked List
mediumRegroup a singly-linked list so all odd-positioned nodes come before all even-positioned nodes.
Partition a List Around a Value
mediumStably rearrange a linked list so every node less than a pivot value comes before every node greater than or equal to it.
Remove the Nth Node From the End of a List
mediumRemove the node that sits n positions from the end of a singly-linked list, then return the list.
Reorder a Linked List
mediumRearrange a singly-linked list by alternating nodes from the front and the back until they meet in the middle.
Rotate a Linked List
mediumRotate a singly-linked list to the right by k places, wrapping around as needed.
Steps to Make Array Non-decreasing
mediumYou are given a 0-indexed integer array nums.
Swap Nodes in Pairs
mediumSwap every two adjacent nodes in a singly-linked list and return the new head.
Merge K Sorted Linked Lists
hardMerge k independently sorted linked lists into a single sorted linked list.
Minimum Pair Removal to Sort Array II
hardGiven an array nums, you can perform the following operation any number of times: Return the minimum number of operations needed to make the array non-decreasing.