0000 - 0099
Solutions categorised by Problem IDs
1 - Two SumFind two indices whose values add up to the target. A hash table lets you look up the complement as you scan the array.2 - Add Two NumbersAdd two numbers stored in reverse-order linked lists by summing one pair of digits at a time and carrying into the next node.3 - Longest Substring Without Repeating CharactersFind the longest substring with distinct characters by sliding a window and tracking which characters it contains.4 - Median of Two Sorted ArraysFind the median of two sorted arrays by scanning them in order or using binary search to locate the middle values.5 - Longest Palindromic SubstringFind the longest palindromic substring with Manacher's algorithm, reusing palindrome lengths around previously visited centers.6 - Zigzag ConversionSimulate the zigzag row pattern and read the rows in order to construct the converted string.7 - Reverse IntegerReverse the decimal digits of a signed integer and check whether the result fits in the 32-bit range.9 - Palindrome NumberCheck whether an integer reads the same in both directions by comparing its digits as text or reversing them numerically.10 - Regular Expression MatchingMatch a string against a pattern containing dots and stars by memoizing the remaining string and pattern positions.11 - Container With Most WaterFind the container that holds the most water by moving two pointers inward and reconsidering the shorter boundary.12 - Integer to RomanConvert an integer to Roman numerals by consuming the largest available values, including subtractive pairs such as IV and IX.13 - Roman to IntegerRead Roman numerals from left to right and account for smaller symbols that precede larger ones.14 - Longest Common PrefixFind the longest prefix shared by all strings by scanning characters or comparing the extremes after sorting.17 - Letter Combinations of a Phone NumberGenerate all letter combinations for phone keypad digits by choosing one letter per digit with backtracking.19 - Remove Nth Node From End of ListRemove the nth node from the end of a linked list by keeping two pointers a fixed distance apart.20 - Valid ParenthesesValidate brackets with a stack that matches each closing bracket to the most recent unmatched opening bracket.21 - Merge Two Sorted ListsMerge two sorted linked lists by repeatedly taking the smaller head, using either iteration or recursion.22 - Generate ParenthesesGenerate balanced strings of parentheses by backtracking and adding a closing bracket only when an opening bracket is available.23 - Merge k Sorted ListsMerge k sorted linked lists in pairs with divide and conquer until a single sorted list remains.24 - Swap Nodes in PairsSwap adjacent linked-list nodes in pairs by rewiring their links, either iteratively or recursively.25 - Reverse Nodes in k-GroupReverse complete groups of k linked-list nodes in place and preserve the order of the final incomplete group.26 - Remove Duplicates from Sorted ArrayRemove duplicates from a sorted array by writing each new value to the next available position.27 - Remove ElementRemove a target value in place with two pointers and return the number of elements kept.28 - Find the Index of the First Occurrence in a StringFind the first occurrence of a substring with a rolling hash and compare it with direct substring search.33 - Search in Rotated Sorted ArraySearch a rotated sorted array by identifying the sorted half at each binary search step.34 - Find First and Last Position of Element in Sorted ArrayLocate the first and last occurrences of a target using binary search for the boundaries of its run.35 - Search Insert PositionUse binary search to find a target's index or the position where it belongs in a sorted array.36 - Valid SudokuCheck Sudoku validity by tracking which digits have appeared in each row, column, and three-by-three box.37 - Sudoku SolverFill a Sudoku grid by trying legal digits in empty cells and backtracking when a choice blocks the solution.39 - Combination SumGenerate combinations that reach a target sum, allowing repeated candidates, with backtracking or dynamic programming.40 - Combination Sum IIGenerate unique combinations that reach the target while using each candidate at most once and skipping duplicate choices.42 - Trapping Rain WaterCompute trapped rainwater from the heights on either side of each bar. Compare two pointers, dynamic programming, and a monotonic stack.45 - Jump Game IIFind the fewest jumps to the last index by treating the positions reachable in each jump as one search level.46 - PermutationsGenerate all permutations of distinct values by choosing an unused value for each position and backtracking.48 - Rotate ImageRotate a square matrix clockwise in place by cycling four cells at a time around each layer.49 - Group AnagramsGroup anagrams with a hash map by assigning words that share the same letters a common key.50 - Pow(x, n)Compute a positive or negative integer power with binary exponentiation, squaring the base as the exponent shrinks.51 - N-QueensPlace n queens with backtracking, discarding placements that share a column or diagonal with an earlier queen.53 - Maximum SubarrayFind the maximum subarray sum with Kadane's algorithm by deciding at each value whether to extend the current run or start again.54 - Spiral MatrixRead a matrix in spiral order by tracking visited cells and turning when the next cell is blocked.55 - Jump GameDecide whether the last array index is reachable by tracking the farthest position each jump can reach.56 - Merge IntervalsMerge overlapping intervals by sorting them and extending the current interval whenever the next one overlaps.57 - Insert IntervalInsert an interval into a sorted list, merge its overlaps, and retain the surrounding disjoint intervals in one pass.58 - Length of Last WordFind the length of the last word by scanning backward past trailing spaces and counting its characters.61 - Rotate ListRotate a linked list by connecting its tail to its head and cutting the resulting cycle at the new tail.62 - Unique PathsCount paths across a grid using combinations or dynamic programming that adds the paths from above and from the left.63 - Unique Paths IICount grid paths around obstacles by assigning zero paths to blocked cells and combining paths from neighboring cells.66 - Plus OneAdd one to a number stored as digits by propagating the carry backward through trailing nines.67 - Add BinaryAdd two binary strings from right to left, carrying into the next position whenever the digit sum reaches two.69 - Sqrt(x)Find the integer square root by binary searching for the largest integer whose square fits within the input.70 - Climbing StairsCount ways to climb stairs using the Fibonacci recurrence for a final move of either one or two steps.72 - Edit DistanceCompute edit distance by comparing insertion, deletion, and replacement costs with memoization or tabulation.73 - Set Matrix ZeroesSet entire matrix rows and columns to zero in place by storing markers in the matrix itself.74 - Search a 2D MatrixLocate a target in a sorted matrix by exploiting the order of its rows and columns with binary search.75 - Sort ColorsSort an array of three colors by counting each color and writing the values back in order.76 - Minimum Window SubstringFind the shortest substring containing all required characters by expanding and shrinking a window of character counts.77 - CombinationsGenerate all k-element combinations from 1 through n by backtracking through increasing choices.78 - SubsetsGenerate the power set using bit masks, backtracking, or iterative expansion of the subsets built so far.79 - Word SearchSearch for a word in a grid by exploring adjacent cells and backtracking to avoid reusing a cell in the same path.84 - Largest Rectangle in HistogramFind the largest rectangle in a histogram with a monotonic stack that tracks bars awaiting a shorter boundary.88 - Merge Sorted ArrayMerge two sorted arrays in place by filling the destination from the back with the larger remaining value.90 - Subsets IIBuild unique subsets of an array containing duplicates by controlling which existing subsets a repeated value can extend.91 - Decode WaysCount valid decodings of a digit string by combining the ways to decode valid one-digit and two-digit groups.93 - Restore IP AddressesRestore valid IP addresses by trying splits into four decimal segments and checking segment lengths, values, and leading zeros.94 - Binary Tree Inorder TraversalTraverse a binary tree in left-root-right order using recursion or an explicit stack.97 - Interleaving StringDecide whether two strings can interleave to form a third by tracking which pairs of prefixes can build each target prefix.98 - Validate Binary Search TreeValidate a binary search tree by checking each node against the value bounds imposed by its ancestors.