20 categories covering all major algorithm patterns
Find two numbers in a sorted array that add up to a target value using the two-pointer technique.
Find two numbers in an unsorted array that add up to a target using a hash map for O(n) lookup.
Reverse a singly linked list by iteratively re-pointing each node to its predecessor.
Detect whether a linked list contains a cycle using Floyd's tortoise and hare algorithm.
Find all start indices of anagrams of a pattern within a string using a sliding window with character counts.
Find the index where a target should be inserted in a sorted array to maintain order.
Determine if a string of brackets is valid by using a stack to match opening and closing pairs.
Find the k most frequently occurring strings using a hash map and a min-heap of size k.
Merge all overlapping intervals by sorting and greedily extending the current interval.
Answer range sum queries in O(1) time after an O(n) prefix sum precomputation.
Mirror a binary tree by recursively swapping each node's left and right children.
Implement a trie with insert, search, and startsWith operations for efficient prefix lookups.
Create a deep copy of a connected undirected graph using BFS or DFS with a visited map.
Generate all possible orderings of a list of distinct numbers by swapping and backtracking.
Count the number of distinct ways to climb n stairs when you can take 1 or 2 steps at a time.
Determine if you can reach the last index of an array by greedily tracking the farthest reachable position.
Sort a linked list in O(n log n) time using merge sort with slow-fast pointer splitting.
Count the number of 1-bits for every integer from 0 to n using DP on the least significant bit.
Traverse a matrix in spiral order by peeling off the outermost layer in each iteration.
Find the contiguous subarray with the largest product. Track both max and min products at each position because two negatives can yield a positive maximum.