Sliding Window
Solve fixed-window problems: maximum sum of k elements, moving averages, and O(n) updates as the window slides.
Scan a sorted array or string from both ends at once to find pairs, remove duplicates, or reverse data in O(n).
Check whether a string reads the same forwards and backwards, ignoring case and punctuation.
Merge two sorted arrays into one sorted array in place.
Remove duplicate values from a sorted array in place and return the new length.
Move every zero in an array to the end while keeping the other numbers in order.
Square every value in a sorted array and return the result sorted, without re-sorting.
Reverse an array of characters in place.
Check whether one string is a subsequence of another.
Check whether two strings are equal once # is treated as a backspace in each.
Check whether a linked list reads the same forwards and backwards.
Find every value that appears in both arrays, as many times as it appears in both.
Reverse only the vowels of a string, leaving every other character in place.
Rearrange an array so every even value comes before every odd value.
Find two numbers in a sorted array that add up to a target value.
Find every unique triplet of numbers in an array that adds up to zero.
Choose two lines from a list of heights that hold the most water between them.
Sort an array of three distinct values in place in a single pass.
Find every unique quadruplet of numbers in an array that adds up to a target value.
Find the triplet in an array whose sum is closest to a target value.
Remove duplicates in place from a sorted array so each value appears at most twice.
Pair the heaviest and lightest people to minimize the number of boats needed within a weight limit.
Detect whether a linked list has a cycle using a fast and slow pointer.
Find the middle node of a linked list in one pass with a fast and slow pointer.
Remove the nth node from the end of a linked list in one pass using two pointers.
Rearrange an array so every even index holds an even value and every odd index holds an odd value.
Rotate an array to the right by k steps in place.
Reverse the order of the words in a sentence while collapsing extra whitespace.
Find every overlapping range between two sorted lists of intervals.
Reorder a linked list by weaving its first half with its reversed second half.
Rearrange an array into the next lexicographically greater arrangement in place.
Solve fixed-window problems: maximum sum of k elements, moving averages, and O(n) updates as the window slides.
Cut a sorted range in half on every step to find a value or boundary in O(log n) instead of checking one by one.
Explore as far as possible down one path before backtracking, used to walk trees, graphs, and grids.
Explore level by level from a starting point, the go-to way to find the shortest path in an unweighted graph.
Break a problem into overlapping subproblems and reuse their answers to avoid recomputing the same work.
Try a choice, keep going, and undo it if it fails, used to generate permutations, combinations, and valid layouts.