Two pointers
Walking an array or string from both ends, or at two speeds, to avoid nested loops.
| Status | Challenge | Topics | Level | Accepted | Save |
|---|---|---|---|---|---|
| 1.Valid PalindromeCheck whether text reads the same both ways, ignoring case and punctuation. | StringsTwo pointers | Easy | – | ||
| 2.Merge Sorted ArraysMerge two sorted arrays into one sorted array. | ArraysTwo pointersSorting | Easy | – | ||
| 3.Move ZerosMove every zero to the end, keeping the other numbers in order. | ArraysTwo pointers | Easy | – | ||
| 4.Squares of a Sorted ArraySquare every number of a sorted array and keep it sorted. | ArraysTwo pointersSorting | Easy | – | ||
| 5.Merge Two Sorted ListsJoin two sorted linked lists into one sorted list. | Linked listsTwo pointers | Easy | – | ||
| 6.Middle of a Linked ListFind the middle node of a linked list in one pass. | Linked listsTwo pointers | Easy | – | ||
| 7.Three SumFind every distinct triple of numbers that adds up to zero. | ArraysTwo pointersSorting | Medium | – | ||
| 8.Container With Most WaterPick two walls that hold the most water between them. | ArraysTwo pointersGreedy | Medium | – | ||
| 9.Remove the Nth Node From the EndUnlink the node n places from the end of a linked list. | Linked listsTwo pointers | Medium | – | ||
| 10.Trapping Rain WaterWork out how much rain water a skyline of bars holds. | ArraysTwo pointersStacks | Hard | – |