LeetCode 00xx

LeetCode practice notes for problems 1 through 99, including A clear explanation of the Two Sum problem using brute force first, then an optimized hash map solution.

99 items

LeetCode 00xx

# Title Difficulty Description
1 LeetCode 1: Two Sum Easy A clear explanation of the Two Sum problem using brute force first, then an optimized hash map solution.
2 LeetCode 2: Add Two Numbers Medium A detailed explanation of the Add Two Numbers linked list problem, including digit-by-digit addition, carry handling, and linked list construction.
3 LeetCode 3: Longest Substring Without Repeating Characters Medium A clear explanation of the longest substring problem using sliding window and a hash set.
4 LeetCode 4: Median of Two Sorted Arrays Hard A detailed explanation of finding the median of two sorted arrays using binary search over partitions.
5 LeetCode 5: Longest Palindromic Substring Medium A detailed explanation of finding the longest palindromic substring using expand-around-center.
6 LeetCode 6: Zigzag Conversion Medium A detailed explanation of converting a string into a zigzag pattern using row simulation.
7 LeetCode 7: Reverse Integer Medium A detailed explanation of reversing a signed 32-bit integer while handling overflow correctly.
8 LeetCode 8: String to Integer (atoi) Medium A detailed explanation of parsing a string into a 32-bit signed integer with whitespace, sign, digit reading, and clamping rules.
9 LeetCode 9: Palindrome Number Easy A detailed explanation of checking whether an integer is a palindrome using digit operations without converting it to a string.
10 LeetCode 10: Regular Expression Matching Hard A detailed explanation of matching a full string against a simplified regular expression with dot and star using dynamic programming.
11 LeetCode 11: Container With Most Water Medium A detailed explanation of finding the maximum water container area using two pointers.
12 LeetCode 12: Integer to Roman Medium A detailed explanation of converting an integer into a Roman numeral using a fixed value-symbol table and greedy subtraction.
13 LeetCode 13: Roman to Integer Easy A detailed explanation of converting a Roman numeral string into an integer using symbol values and the subtraction rule.
14 LeetCode 14: Longest Common Prefix Easy A detailed explanation of finding the longest common prefix among an array of strings by comparing characters column by column.
15 LeetCode 15: 3Sum Medium A detailed explanation of finding all unique triplets that sum to zero using sorting and two pointers.
16 LeetCode 16: 3Sum Closest Medium A detailed explanation of finding the sum of three integers closest to a target using sorting and two pointers.
17 LeetCode 17: Letter Combinations of a Phone Number Medium A detailed explanation of generating all possible phone keypad letter combinations using backtracking.
18 LeetCode 18: 4Sum Medium A detailed explanation of finding all unique quadruplets that sum to a target using sorting and two pointers.
19 LeetCode 19: Remove Nth Node From End of List Medium A detailed explanation of removing the nth node from the end of a singly linked list using two pointers and a dummy node.
20 LeetCode 20: Valid Parentheses Easy A detailed explanation of checking whether a bracket string is valid using a stack.
21 LeetCode 21: Merge Two Sorted Lists Easy A detailed explanation of merging two sorted linked lists using a dummy node and pointer splicing.
22 LeetCode 22: Generate Parentheses Medium A detailed explanation of generating all well-formed parentheses strings using backtracking.
23 LeetCode 23: Merge k Sorted Lists Hard A detailed explanation of merging k sorted linked lists using a min heap.
24 LeetCode 24: Swap Nodes in Pairs Medium A detailed explanation of swapping every two adjacent nodes in a linked list using pointer manipulation.
25 LeetCode 25: Reverse Nodes in k-Group Hard A detailed explanation of reversing linked-list nodes in groups of k using pointer manipulation and constant extra space.
26 LeetCode 26: Remove Duplicates from Sorted Array Easy A clear explanation of removing duplicates from a sorted array in place using two pointers.
27 LeetCode 27: Remove Element Easy A clear explanation of removing all occurrences of a value from an array in place using a write pointer.
28 LeetCode 28: Find the Index of the First Occurrence in a String Easy A clear explanation of finding the first occurrence of one string inside another using direct string matching.
29 LeetCode 29: Divide Two Integers Medium A clear explanation of integer division without using multiplication, division, or modulo, using repeated doubling with bit shifts.
30 LeetCode 30: Substring with Concatenation of All Words Hard A clear explanation of finding all starting indices where a substring is formed by concatenating every word exactly once.
31 LeetCode 31: Next Permutation Medium A clear explanation of finding the next lexicographically greater permutation in place using a right-to-left scan.
32 LeetCode 32: Longest Valid Parentheses Hard A clear explanation of finding the longest well-formed parentheses substring using a stack of indices.
33 LeetCode 33: Search in Rotated Sorted Array Medium A clear explanation of searching a rotated sorted array in logarithmic time using modified binary search.
34 LeetCode 34: Find First and Last Position of Element in Sorted Array Medium A clear explanation of finding the first and last index of a target in a sorted array using two binary searches.
35 LeetCode 35: Search Insert Position Easy A clear explanation of finding the index of a target, or where it should be inserted, using binary search.
36 LeetCode 36: Valid Sudoku Medium A clear explanation of checking whether a partially filled Sudoku board is valid using hash sets.
37 LeetCode 37: Sudoku Solver Hard A clear explanation of solving a Sudoku board using backtracking and constraint checking.
38 LeetCode 38: Count and Say Medium A clear explanation of generating the count-and-say sequence using run-length encoding.
39 LeetCode 39: Combination Sum Medium A clear explanation of finding all unique combinations that sum to a target using backtracking.
40 LeetCode 40: Combination Sum II Medium A clear explanation of finding unique combinations that sum to a target when each array element may be used at most once.
41 LeetCode 41: First Missing Positive Hard A clear explanation of the First Missing Positive problem using in-place index placement to achieve O(n) time and O(1) extra space.
42 LeetCode 42: Trapping Rain Water Hard A clear explanation of the Trapping Rain Water problem using left and right boundaries, then an optimized two-pointer solution.
43 LeetCode 43: Multiply Strings Medium A clear explanation of Multiply Strings using grade-school multiplication with digit arrays.
44 LeetCode 44: Wildcard Matching Hard A clear explanation of Wildcard Matching using dynamic programming over string and pattern prefixes.
45 LeetCode 45: Jump Game II Medium A clear explanation of Jump Game II using a greedy range expansion approach to find the minimum number of jumps.
46 LeetCode 46: Permutations Medium A clear explanation of Permutations using depth-first search and backtracking.
47 LeetCode 47: Permutations II Medium A clear explanation of Permutations II using sorting, depth-first search, and duplicate-skipping backtracking.
48 LeetCode 48: Rotate Image Medium A clear explanation of Rotate Image using in-place matrix transpose and row reversal.
49 LeetCode 49: Group Anagrams Medium A clear explanation of Group Anagrams using a hash map keyed by each word's sorted character signature.
50 LeetCode 50: Pow(x, n) Medium A clear explanation of Pow(x, n) using binary exponentiation to compute powers in logarithmic time.
51 LeetCode 51: N-Queens Hard A clear guide to solving N-Queens with backtracking, row-by-row placement, and constant-time conflict checks.
52 LeetCode 52: N-Queens II Hard A clear guide to solving N-Queens II by counting valid queen placements with backtracking.
53 LeetCode 53: Maximum Subarray Medium A clear guide to solving Maximum Subarray with brute force first, then Kadane's dynamic programming algorithm.
54 LeetCode 54: Spiral Matrix Medium A clear guide to reading a matrix in spiral order using shrinking boundaries.
55 LeetCode 55: Jump Game Medium A clear guide to solving Jump Game with greedy reachability.
56 LeetCode 56: Merge Intervals Medium A clear guide to solving Merge Intervals by sorting intervals and merging them in one pass.
57 LeetCode 57: Insert Interval Medium A clear guide to solving Insert Interval with one linear scan over sorted, non-overlapping intervals.
58 LeetCode 58: Length of Last Word Easy A clear guide to solving Length of Last Word by scanning the string from right to left.
59 LeetCode 59: Spiral Matrix II Medium A clear guide to generating an n x n matrix filled from 1 to n squared in spiral order.
60 LeetCode 60: Permutation Sequence Hard A clear guide to finding the kth permutation sequence using factorial blocks instead of generating all permutations.
61 LeetCode 61: Rotate List Medium A clear guide to rotating a linked list to the right by k places using a circular list.
62 LeetCode 62: Unique Paths Medium A clear guide to counting unique paths in a grid using dynamic programming.
63 LeetCode 63: Unique Paths II Medium A clear guide to counting unique paths in a grid with obstacles using dynamic programming.
64 LeetCode 64: Minimum Path Sum Medium A clear guide to finding the minimum path sum in a grid using dynamic programming.
65 LeetCode 65: Valid Number Hard A clear guide to validating whether a string is a valid number using grammar rules and one left-to-right scan.
66 LeetCode 66: Plus One Easy A clear guide to adding one to a large integer represented as an array of digits.
67 LeetCode 67: Add Binary Easy A clear guide to adding two binary strings using two pointers and a carry.
68 LeetCode 68: Text Justification Hard A clear guide to formatting text with greedy line packing and even space distribution.
69 LeetCode 69: Sqrt(x) Easy A clear guide to computing the integer square root using binary search without built-in exponent functions.
70 LeetCode 70: Climbing Stairs Easy A clear guide to counting distinct ways to climb stairs using dynamic programming.
71 LeetCode 71: Simplify Path Medium A clear guide to simplifying Unix-style file paths using a stack.
72 LeetCode 72: Edit Distance Hard A clear guide to computing the minimum number of insert, delete, and replace operations needed to convert one string into another.
73 LeetCode 73: Set Matrix Zeroes Medium A clear guide to setting matrix rows and columns to zero in place using the first row and first column as markers.
74 LeetCode 74: Search a 2D Matrix Medium A clear guide to searching a sorted 2D matrix using binary search over a virtual one-dimensional array.
75 LeetCode 75: Sort Colors Medium A clear guide to sorting an array of 0s, 1s, and 2s in place using the Dutch National Flag algorithm.
76 LeetCode 76: Minimum Window Substring Hard A detailed guide to solving Minimum Window Substring with a sliding window and frequency counters.
77 LeetCode 77: Combinations Medium A detailed guide to solving Combinations with backtracking and pruning.
78 LeetCode 78: Subsets Medium A detailed guide to solving Subsets with backtracking and the include-or-skip recursion idea.
79 LeetCode 79: Word Search Medium A detailed guide to solving Word Search with depth-first search and backtracking on a grid.
80 LeetCode 80: Remove Duplicates from Sorted Array II Medium A detailed guide to solving Remove Duplicates from Sorted Array II with an in-place two-pointer method.
81 LeetCode 81: Search in Rotated Sorted Array II Medium A detailed guide to solving Search in Rotated Sorted Array II with modified binary search and duplicate handling.
82 LeetCode 82: Remove Duplicates from Sorted List II Medium A detailed guide to solving Remove Duplicates from Sorted List II with a dummy node and pointer rewiring.
83 LeetCode 83: Remove Duplicates from Sorted List Easy A detailed guide to solving Remove Duplicates from Sorted List with one pointer and in-place linked list rewiring.
84 LeetCode 84: Largest Rectangle in Histogram Hard A detailed guide to solving Largest Rectangle in Histogram with a monotonic increasing stack.
85 LeetCode 85: Maximal Rectangle Hard A detailed guide to solving Maximal Rectangle by converting each matrix row into a histogram and applying a monotonic stack.
86 LeetCode 86: Partition List Medium A detailed guide to solving Partition List with two dummy lists while preserving relative order.
87 LeetCode 87: Scramble String Hard A detailed guide to solving Scramble String with recursive dynamic programming and memoization.
88 LeetCode 88: Merge Sorted Array Easy A detailed guide to solving Merge Sorted Array in-place by merging from the back with three pointers.
89 LeetCode 89: Gray Code Medium A detailed guide to solving Gray Code using the binary-to-Gray-code formula.
90 LeetCode 90: Subsets II Medium A detailed guide to solving Subsets II with sorting, backtracking, and duplicate skipping.
91 LeetCode 91: Decode Ways Medium A detailed guide to solving Decode Ways with dynamic programming and careful handling of zeroes.
92 LeetCode 92: Reverse Linked List II Medium A detailed guide to solving Reverse Linked List II with a dummy node and in-place sublist reversal.
93 LeetCode 93: Restore IP Addresses Medium A detailed guide to solving Restore IP Addresses with backtracking over four valid IP segments.
94 LeetCode 94: Binary Tree Inorder Traversal Easy A detailed guide to solving Binary Tree Inorder Traversal with recursion and an iterative stack.
95 LeetCode 95: Unique Binary Search Trees II Medium A detailed guide to solving Unique Binary Search Trees II with recursive tree generation over value ranges.
96 LeetCode 96: Unique Binary Search Trees Medium A detailed guide to solving Unique Binary Search Trees with dynamic programming and the Catalan recurrence.
97 LeetCode 97: Interleaving String Medium A detailed guide to solving Interleaving String with two-dimensional dynamic programming.
98 LeetCode 98: Validate Binary Search Tree Medium A detailed guide to solving Validate Binary Search Tree with recursive lower and upper bounds.
99 LeetCode 99: Recover Binary Search Tree Medium A detailed guide to solving Recover Binary Search Tree with inorder traversal and two misplaced nodes.