Skip to content

LeetCode 02xx

LeetCode practice notes for problems 200 through 299, including A clear explanation of counting connected groups of land cells in a grid using DFS or BFS.

#TitleDifficultyDescription
200LeetCode 200: Number of IslandsMediumA clear explanation of counting connected groups of land cells in a grid using DFS or BFS.
201LeetCode 201: Bitwise AND of Numbers RangeMediumA clear explanation of finding the bitwise AND of every number in an inclusive range using the common binary prefix.
202LeetCode 202: Happy NumberEasyA clear explanation of detecting whether repeated digit-square sums eventually reach 1.
203LeetCode 203: Remove Linked List ElementsEasyA clear explanation of removing all linked list nodes with a target value using iteration and a dummy node.
204LeetCode 204: Count PrimesMediumA clear explanation of counting prime numbers less than n using the Sieve of Eratosthenes.
205LeetCode 205: Isomorphic StringsEasyA clear explanation of checking whether two strings follow the same character mapping pattern.
206LeetCode 206: Reverse Linked ListEasyA clear explanation of reversing a singly linked list using iterative and recursive approaches.
207LeetCode 207: Course ScheduleMediumA clear explanation of detecting cycles in a prerequisite graph using topological sorting and DFS.
208LeetCode 208: Implement Trie Prefix TreeMediumA clear explanation of implementing a Trie with insert, search, and startsWith operations.
209LeetCode 209: Minimum Size Subarray SumMediumA clear explanation of finding the shortest contiguous subarray whose sum is at least target using a sliding window.
210LeetCode 210: Course Schedule IIMediumA clear explanation of finding a valid course ordering using topological sorting and cycle detection.
211LeetCode 211: Design Add and Search Words Data StructureMediumA clear explanation of designing a word dictionary with addWord and wildcard search using a Trie and DFS.
212LeetCode 212: Word Search IIHardA clear explanation of finding multiple words in a character board using a Trie and DFS backtracking.
213LeetCode 213: House Robber IIMediumA clear explanation of maximizing robbed money from circularly arranged houses using dynamic programming.
214LeetCode 214: Shortest PalindromeHardA clear explanation of building the shortest palindrome by finding the longest palindromic prefix using KMP.
215LeetCode 215: Kth Largest Element in an ArrayMediumA clear explanation of finding the kth largest element using sorting, a min-heap, and Quickselect.
216LeetCode 216: Combination Sum IIIMediumA clear explanation of finding k distinct numbers from 1 to 9 that sum to n using backtracking.
217LeetCode 217: Contains DuplicateEasyA clear explanation of detecting duplicates in an array using a hash set and sorting.
218LeetCode 218: The Skyline ProblemHardA clear explanation of computing the skyline formed by buildings using sweep line and a max-heap.
219LeetCode 219: Contains Duplicate IIEasyA clear explanation of detecting whether equal values appear within distance k using a hash map or sliding window set.
220LeetCode 220: Contains Duplicate IIIHardA clear explanation of checking nearby indices with nearby values using a sliding window and bucket hashing.
221LeetCode 221: Maximal SquareMediumA clear explanation of finding the largest square of 1s in a binary matrix using dynamic programming.
222LeetCode 222: Count Complete Tree NodesEasyA clear explanation of counting nodes in a complete binary tree faster than visiting every node.
223LeetCode 223: Rectangle AreaMediumA clear explanation of computing the total covered area of two axis-aligned rectangles by subtracting their overlap.
224LeetCode 224: Basic CalculatorHardA clear explanation of evaluating an expression with plus, minus, spaces, and parentheses using a stack.
225LeetCode 225: Implement Stack using QueuesEasyA clear explanation of implementing a LIFO stack using only FIFO queue operations.
226LeetCode 226: Invert Binary TreeEasyA clear explanation of inverting a binary tree using recursive depth-first traversal.
227LeetCode 227: Basic Calculator IIMediumA detailed explanation of evaluating arithmetic expressions with stack-based parsing and operator precedence.
228LeetCode 228: Summary RangesEasyA clear explanation of summarizing a sorted unique integer array into compact consecutive ranges.
229LeetCode 229: Majority Element IIMediumA clear explanation of finding all elements that appear more than n/3 times using the extended Boyer-Moore voting algorithm.
230LeetCode 230: Kth Smallest Element in a BSTMediumA clear explanation of finding the kth smallest value in a binary search tree using inorder traversal.
231LeetCode 231: Power of TwoEasyA clear explanation of determining whether an integer is a power of two using binary properties and bit manipulation.
232LeetCode 232: Implement Queue using StacksEasyA detailed explanation of implementing a FIFO queue using two LIFO stacks with amortized constant time operations.
233LeetCode 233: Number of Digit OneHardA detailed explanation of counting how many times digit one appears from 0 to n using positional digit analysis.
234LeetCode 234: Palindrome Linked ListEasyA clear explanation of checking whether a singly linked list is a palindrome using fast and slow pointers plus in-place reversal.
235LeetCode 235: Lowest Common Ancestor of a Binary Search TreeMediumA clear explanation of finding the lowest common ancestor in a binary search tree using BST ordering properties.
236LeetCode 236: Lowest Common Ancestor of a Binary TreeMediumA clear explanation of finding the lowest common ancestor in a normal binary tree using recursive depth-first search.
237LeetCode 237: Delete Node in a Linked ListMediumA clear explanation of deleting a node from a singly linked list when only that node is given.
238LeetCode 238: Product of Array Except SelfMediumA clear explanation of computing each product except self using prefix and suffix products without division.
239LeetCode 239: Sliding Window MaximumHardA clear explanation of finding the maximum value in every sliding window using a monotonic deque.
240LeetCode 240: Search a 2D Matrix IIMediumA clear explanation of searching a row-sorted and column-sorted matrix using the top-right corner elimination method.
241LeetCode 241: Different Ways to Add ParenthesesMediumA clear explanation of generating all possible results from different parenthesizations using divide and conquer recursion.
242LeetCode 242: Valid AnagramEasyA clear explanation of checking whether two strings are anagrams using character frequency counting.
243LeetCode 243: Shortest Word DistanceEasyA clear explanation of the Shortest Word Distance problem using one pass and the latest seen indices of both words.
244LeetCode 244: Shortest Word Distance IIMediumA clear explanation of the Shortest Word Distance II problem using preprocessing and two pointers.
245LeetCode 245: Shortest Word Distance IIIMediumA clear explanation of the Shortest Word Distance III problem, including the special case where both target words are the same.
246LeetCode 246: Strobogrammatic NumberEasyA clear explanation of the Strobogrammatic Number problem using digit rotation rules and two pointers.
247LeetCode 247: Strobogrammatic Number IIMediumA clear explanation of generating all strobogrammatic numbers of length n using recursion from the inside out.
248LeetCode 248: Strobogrammatic Number IIIHardA clear explanation of counting strobogrammatic numbers in a string range using recursive generation and range filtering.
249LeetCode 249: Group Shifted StringsMediumA clear explanation of grouping strings by their shifting sequence using normalized hash keys.
250LeetCode 250: Count Univalue SubtreesMediumA clear explanation of counting uni-value subtrees using post-order DFS.
251LeetCode 251: Flatten 2D VectorMediumA clear explanation of the Flatten 2D Vector problem using row and column pointers to implement an iterator.
252LeetCode 252: Meeting RoomsEasyA clear explanation of the Meeting Rooms problem using interval sorting to detect overlaps.
253LeetCode 253: Meeting Rooms IIMediumA clear explanation of the Meeting Rooms II problem using a min heap to track active meeting end times.
254LeetCode 254: Factor CombinationsMediumA clear explanation of the Factor Combinations problem using DFS backtracking with non-decreasing factors.
255LeetCode 255: Verify Preorder Sequence in Binary Search TreeMediumA clear explanation of the Verify Preorder Sequence in Binary Search Tree problem using a monotonic stack and lower bound tracking.
256LeetCode 256: Paint HouseMediumA clear explanation of the Paint House problem using dynamic programming with constant space.
257LeetCode 257: Binary Tree PathsEasyA clear explanation of the Binary Tree Paths problem using DFS backtracking to collect every root-to-leaf path.
258LeetCode 258: Add DigitsEasyA clear explanation of the Add Digits problem using repeated digit sums first, then the digital root formula.
259LeetCode 259: 3Sum SmallerMediumA clear explanation of the 3Sum Smaller problem using sorting and the two-pointer technique.
260LeetCode 260: Single Number IIIMediumA clear explanation of the Single Number III problem using XOR partitioning to isolate the two unique numbers.
261LeetCode 261: Graph Valid TreeMediumA clear explanation of the Graph Valid Tree problem using Union Find to detect cycles and verify connectivity.
262LeetCode 262: Trips and UsersHardA clear explanation of the Trips and Users SQL problem using joins, filtering, grouping, and conditional aggregation.
263LeetCode 263: Ugly NumberEasyA clear explanation of the Ugly Number problem using repeated division by the only allowed prime factors.
264LeetCode 264: Ugly Number IIMediumA clear explanation of the Ugly Number II problem using dynamic programming with three pointers.
265LeetCode 265: Paint House IIHardA clear explanation of the Paint House II problem using optimized dynamic programming with minimum and second minimum tracking.
266LeetCode 266: Palindrome PermutationEasyA clear explanation of the Palindrome Permutation problem using character parity counting.
267LeetCode 267: Palindrome Permutation IIMediumA clear explanation of the Palindrome Permutation II problem using character counts and backtracking over half of the palindrome.
268LeetCode 268: Missing NumberEasyA clear explanation of the Missing Number problem using sum formula and XOR.
269LeetCode 269: Alien DictionaryHardA clear explanation of the Alien Dictionary problem using graph construction and topological sorting.
270LeetCode 270: Closest Binary Search Tree ValueEasyA clear explanation of the Closest Binary Search Tree Value problem using the BST property to walk toward the target.
271LeetCode 271: Encode and Decode StringsMediumA clear explanation of the Encode and Decode Strings problem using length-prefix encoding.
272LeetCode 272: Closest Binary Search Tree Value IIHardA clear explanation of the Closest Binary Search Tree Value II problem using inorder traversal and a fixed-size sliding window.
273LeetCode 273: Integer to English WordsHardA clear explanation of the Integer to English Words problem using three-digit chunks and scale words.
274LeetCode 274: H-IndexMediumA clear explanation of the H-Index problem using sorting, then an optimized counting approach.
275LeetCode 275: H-Index IIMediumA clear explanation of the H-Index II problem using binary search on a sorted citations array.
276LeetCode 276: Paint FenceMediumA dynamic programming solution for counting ways to paint fence posts with no more than two adjacent posts sharing the same color.
277LeetCode 277: Find the CelebrityMediumA two-pass solution for finding a celebrity using the knows API with O(n) calls and O(1) extra space.
278LeetCode 278: First Bad VersionEasyA binary search solution for finding the first bad version while minimizing calls to the isBadVersion API.
279LeetCode 279: Perfect SquaresMediumA dynamic programming solution for finding the least number of perfect square numbers that sum to n.
280LeetCode 280: Wiggle SortMediumA greedy in-place solution for rearranging an array into a non-strict wiggle pattern.
281LeetCode 281: Zigzag IteratorMediumA queue-based iterator design for returning elements from two vectors in alternating order, with a clean extension to k vectors.
282LeetCode 282: Expression Add OperatorsHardA backtracking solution for inserting operators into a numeric string so the expression evaluates to a target value.
283LeetCode 283: Move ZeroesEasyA two-pointer in-place solution for moving all zeroes to the end while preserving the relative order of non-zero elements.
284LeetCode 284: Peeking IteratorMediumA wrapper iterator design that supports peeking at the next element without advancing the iterator.
285LeetCode 285: Inorder Successor in BSTMediumA binary-search-style solution for finding the smallest node greater than p in a binary search tree.
286LeetCode 286: Walls and GatesMediumA multi-source BFS solution for filling each empty room with its shortest distance to the nearest gate.
287LeetCode 287: Find the Duplicate NumberMediumA Floyd cycle detection solution for finding the repeated number without modifying the array and using constant extra space.
288LeetCode 288: Unique Word AbbreviationMediumA hash map design for checking whether a word’s abbreviation is unique in a dictionary.
289LeetCode 289: Game of LifeMediumAn in-place matrix simulation for computing the next state of Conway’s Game of Life using temporary encoded states.
290LeetCode 290: Word PatternEasyA hash map solution for checking whether a pattern string and a space-separated word string form a bijection.
291LeetCode 291: Word Pattern IIMediumA backtracking solution for matching a pattern string to a target string using a bijective character-to-substring mapping.
292LeetCode 292: Nim GameEasyA game theory solution for deciding whether the first player can win by using the losing-position pattern of multiples of four.
293LeetCode 293: Flip GameEasyA simple string scanning solution for generating every possible next state after flipping one consecutive ++ pair into –.
294LeetCode 294: Flip Game IIMediumA recursive game theory solution with memoization for deciding whether the starting player can force a win.
295LeetCode 295: Find Median from Data StreamHardA two-heap data structure for adding numbers from a stream and returning the current median in constant time.
296LeetCode 296: Best Meeting PointHardA median-based solution for minimizing total Manhattan distance in a grid.
297LeetCode 297: Serialize and Deserialize Binary TreeHardA preorder DFS codec for converting a binary tree to a string and reconstructing the same tree from that string.
298LeetCode 298: Binary Tree Longest Consecutive SequenceMediumA DFS solution for finding the longest parent-to-child path where each node value increases by exactly one.
299LeetCode 299: Bulls and CowsMediumA counting solution for producing the Bulls and Cows hint while handling duplicate digits correctly.
LeetCode 200: Number of IslandsA clear explanation of counting connected groups of land cells in a grid using DFS or BFS.
6 min
LeetCode 201: Bitwise AND of Numbers RangeA clear explanation of finding the bitwise AND of every number in an inclusive range using the common binary prefix.
6 min
LeetCode 202: Happy NumberA clear explanation of detecting whether repeated digit-square sums eventually reach 1.
6 min
LeetCode 203: Remove Linked List ElementsA clear explanation of removing all linked list nodes with a target value using iteration and a dummy node.
5 min
LeetCode 204: Count PrimesA clear explanation of counting prime numbers less than n using the Sieve of Eratosthenes.
5 min
LeetCode 205: Isomorphic StringsA clear explanation of checking whether two strings follow the same character mapping pattern.
5 min
LeetCode 206: Reverse Linked ListA clear explanation of reversing a singly linked list using iterative and recursive approaches.
4 min
LeetCode 207: Course ScheduleA clear explanation of detecting cycles in a prerequisite graph using topological sorting and DFS.
6 min
LeetCode 208: Implement Trie Prefix TreeA clear explanation of implementing a Trie with insert, search, and startsWith operations.
6 min
LeetCode 209: Minimum Size Subarray SumA clear explanation of finding the shortest contiguous subarray whose sum is at least target using a sliding window.
6 min
LeetCode 210: Course Schedule IIA clear explanation of finding a valid course ordering using topological sorting and cycle detection.
6 min
LeetCode 211: Design Add and Search Words Data StructureA clear explanation of designing a word dictionary with addWord and wildcard search using a Trie and DFS.
6 min
LeetCode 212: Word Search IIA clear explanation of finding multiple words in a character board using a Trie and DFS backtracking.
8 min
LeetCode 213: House Robber IIA clear explanation of maximizing robbed money from circularly arranged houses using dynamic programming.
6 min
LeetCode 214: Shortest PalindromeA clear explanation of building the shortest palindrome by finding the longest palindromic prefix using KMP.
6 min
LeetCode 215: Kth Largest Element in an ArrayA clear explanation of finding the kth largest element using sorting, a min-heap, and Quickselect.
6 min
LeetCode 216: Combination Sum IIIA clear explanation of finding k distinct numbers from 1 to 9 that sum to n using backtracking.
7 min
LeetCode 217: Contains DuplicateA clear explanation of detecting duplicates in an array using a hash set and sorting.
4 min
LeetCode 218: The Skyline ProblemA clear explanation of computing the skyline formed by buildings using sweep line and a max-heap.
6 min
LeetCode 219: Contains Duplicate IIA clear explanation of detecting whether equal values appear within distance k using a hash map or sliding window set.
5 min
LeetCode 220: Contains Duplicate IIIA clear explanation of checking nearby indices with nearby values using a sliding window and bucket hashing.
7 min
LeetCode 221: Maximal SquareA clear explanation of finding the largest square of 1s in a binary matrix using dynamic programming.
6 min
LeetCode 222: Count Complete Tree NodesA clear explanation of counting nodes in a complete binary tree faster than visiting every node.
6 min
LeetCode 223: Rectangle AreaA clear explanation of computing the total covered area of two axis-aligned rectangles by subtracting their overlap.
6 min
LeetCode 224: Basic CalculatorA clear explanation of evaluating an expression with plus, minus, spaces, and parentheses using a stack.
6 min
LeetCode 225: Implement Stack using QueuesA clear explanation of implementing a LIFO stack using only FIFO queue operations.
5 min
LeetCode 226: Invert Binary TreeA clear explanation of inverting a binary tree using recursive depth-first traversal.
5 min
LeetCode 227: Basic Calculator IIA detailed explanation of evaluating arithmetic expressions with stack-based parsing and operator precedence.
4 min
LeetCode 228: Summary RangesA clear explanation of summarizing a sorted unique integer array into compact consecutive ranges.
5 min
LeetCode 229: Majority Element IIA clear explanation of finding all elements that appear more than n/3 times using the extended Boyer-Moore voting algorithm.
6 min
LeetCode 230: Kth Smallest Element in a BSTA clear explanation of finding the kth smallest value in a binary search tree using inorder traversal.
6 min
LeetCode 231: Power of TwoA clear explanation of determining whether an integer is a power of two using binary properties and bit manipulation.
4 min
LeetCode 232: Implement Queue using StacksA detailed explanation of implementing a FIFO queue using two LIFO stacks with amortized constant time operations.
4 min
LeetCode 233: Number of Digit OneA detailed explanation of counting how many times digit one appears from 0 to n using positional digit analysis.
6 min
LeetCode 234: Palindrome Linked ListA clear explanation of checking whether a singly linked list is a palindrome using fast and slow pointers plus in-place reversal.
6 min
LeetCode 235: Lowest Common Ancestor of a Binary Search TreeA clear explanation of finding the lowest common ancestor in a binary search tree using BST ordering properties.
6 min
LeetCode 236: Lowest Common Ancestor of a Binary TreeA clear explanation of finding the lowest common ancestor in a normal binary tree using recursive depth-first search.
6 min
LeetCode 237: Delete Node in a Linked ListA clear explanation of deleting a node from a singly linked list when only that node is given.
5 min
LeetCode 238: Product of Array Except SelfA clear explanation of computing each product except self using prefix and suffix products without division.
5 min
LeetCode 239: Sliding Window MaximumA clear explanation of finding the maximum value in every sliding window using a monotonic deque.
5 min
LeetCode 240: Search a 2D Matrix IIA clear explanation of searching a row-sorted and column-sorted matrix using the top-right corner elimination method.
6 min
LeetCode 241: Different Ways to Add ParenthesesA clear explanation of generating all possible results from different parenthesizations using divide and conquer recursion.
5 min
LeetCode 242: Valid AnagramA clear explanation of checking whether two strings are anagrams using character frequency counting.
4 min
LeetCode 243: Shortest Word DistanceA clear explanation of the Shortest Word Distance problem using one pass and the latest seen indices of both words.
5 min
LeetCode 244: Shortest Word Distance IIA clear explanation of the Shortest Word Distance II problem using preprocessing and two pointers.
5 min
LeetCode 245: Shortest Word Distance IIIA clear explanation of the Shortest Word Distance III problem, including the special case where both target words are the same.
4 min
LeetCode 246: Strobogrammatic NumberA clear explanation of the Strobogrammatic Number problem using digit rotation rules and two pointers.
4 min
LeetCode 247: Strobogrammatic Number IIA clear explanation of generating all strobogrammatic numbers of length n using recursion from the inside out.
5 min
LeetCode 248: Strobogrammatic Number IIIA clear explanation of counting strobogrammatic numbers in a string range using recursive generation and range filtering.
6 min
LeetCode 249: Group Shifted StringsA clear explanation of grouping strings by their shifting sequence using normalized hash keys.
5 min
LeetCode 250: Count Univalue SubtreesA clear explanation of counting uni-value subtrees using post-order DFS.
5 min
LeetCode 251: Flatten 2D VectorA clear explanation of the Flatten 2D Vector problem using row and column pointers to implement an iterator.
6 min
LeetCode 252: Meeting RoomsA clear explanation of the Meeting Rooms problem using interval sorting to detect overlaps.
4 min
LeetCode 253: Meeting Rooms IIA clear explanation of the Meeting Rooms II problem using a min heap to track active meeting end times.
5 min
LeetCode 254: Factor CombinationsA clear explanation of the Factor Combinations problem using DFS backtracking with non-decreasing factors.
6 min
LeetCode 255: Verify Preorder Sequence in Binary Search TreeA clear explanation of the Verify Preorder Sequence in Binary Search Tree problem using a monotonic stack and lower bound tracking.
7 min
LeetCode 256: Paint HouseA clear explanation of the Paint House problem using dynamic programming with constant space.
5 min
LeetCode 257: Binary Tree PathsA clear explanation of the Binary Tree Paths problem using DFS backtracking to collect every root-to-leaf path.
5 min
LeetCode 258: Add DigitsA clear explanation of the Add Digits problem using repeated digit sums first, then the digital root formula.
4 min
LeetCode 259: 3Sum SmallerA clear explanation of the 3Sum Smaller problem using sorting and the two-pointer technique.
5 min
LeetCode 260: Single Number IIIA clear explanation of the Single Number III problem using XOR partitioning to isolate the two unique numbers.
5 min
LeetCode 261: Graph Valid TreeA clear explanation of the Graph Valid Tree problem using Union Find to detect cycles and verify connectivity.
6 min
LeetCode 262: Trips and UsersA clear explanation of the Trips and Users SQL problem using joins, filtering, grouping, and conditional aggregation.
5 min
LeetCode 263: Ugly NumberA clear explanation of the Ugly Number problem using repeated division by the only allowed prime factors.
4 min
LeetCode 264: Ugly Number IIA clear explanation of the Ugly Number II problem using dynamic programming with three pointers.
5 min
LeetCode 265: Paint House IIA clear explanation of the Paint House II problem using optimized dynamic programming with minimum and second minimum tracking.
5 min
LeetCode 266: Palindrome PermutationA clear explanation of the Palindrome Permutation problem using character parity counting.
5 min
LeetCode 267: Palindrome Permutation IIA clear explanation of the Palindrome Permutation II problem using character counts and backtracking over half of the palindrome.
5 min
LeetCode 268: Missing NumberA clear explanation of the Missing Number problem using sum formula and XOR.
4 min
LeetCode 269: Alien DictionaryA clear explanation of the Alien Dictionary problem using graph construction and topological sorting.
7 min
LeetCode 270: Closest Binary Search Tree ValueA clear explanation of the Closest Binary Search Tree Value problem using the BST property to walk toward the target.
6 min
LeetCode 271: Encode and Decode StringsA clear explanation of the Encode and Decode Strings problem using length-prefix encoding.
4 min
LeetCode 272: Closest Binary Search Tree Value IIA clear explanation of the Closest Binary Search Tree Value II problem using inorder traversal and a fixed-size sliding window.
6 min
LeetCode 273: Integer to English WordsA clear explanation of the Integer to English Words problem using three-digit chunks and scale words.
6 min
LeetCode 274: H-IndexA clear explanation of the H-Index problem using sorting, then an optimized counting approach.
5 min
LeetCode 275: H-Index IIA clear explanation of the H-Index II problem using binary search on a sorted citations array.
6 min
LeetCode 276: Paint FenceA dynamic programming solution for counting ways to paint fence posts with no more than two adjacent posts sharing the same color.
5 min
LeetCode 277: Find the CelebrityA two-pass solution for finding a celebrity using the knows API with O(n) calls and O(1) extra space.
6 min
LeetCode 278: First Bad VersionA binary search solution for finding the first bad version while minimizing calls to the isBadVersion API.
5 min
LeetCode 279: Perfect SquaresA dynamic programming solution for finding the least number of perfect square numbers that sum to n.
5 min
LeetCode 280: Wiggle SortA greedy in-place solution for rearranging an array into a non-strict wiggle pattern.
5 min
LeetCode 281: Zigzag IteratorA queue-based iterator design for returning elements from two vectors in alternating order, with a clean extension to k vectors.
6 min
LeetCode 282: Expression Add OperatorsA backtracking solution for inserting operators into a numeric string so the expression evaluates to a target value.
6 min
LeetCode 283: Move ZeroesA two-pointer in-place solution for moving all zeroes to the end while preserving the relative order of non-zero elements.
4 min
LeetCode 284: Peeking IteratorA wrapper iterator design that supports peeking at the next element without advancing the iterator.
4 min
LeetCode 285: Inorder Successor in BSTA binary-search-style solution for finding the smallest node greater than p in a binary search tree.
5 min
LeetCode 286: Walls and GatesA multi-source BFS solution for filling each empty room with its shortest distance to the nearest gate.
6 min
LeetCode 287: Find the Duplicate NumberA Floyd cycle detection solution for finding the repeated number without modifying the array and using constant extra space.
5 min
LeetCode 288: Unique Word AbbreviationA hash map design for checking whether a word's abbreviation is unique in a dictionary.
5 min
LeetCode 289: Game of LifeAn in-place matrix simulation for computing the next state of Conway's Game of Life using temporary encoded states.
6 min
LeetCode 290: Word PatternA hash map solution for checking whether a pattern string and a space-separated word string form a bijection.
5 min
LeetCode 291: Word Pattern IIA backtracking solution for matching a pattern string to a target string using a bijective character-to-substring mapping.
6 min
LeetCode 292: Nim GameA game theory solution for deciding whether the first player can win by using the losing-position pattern of multiples of four.
5 min
LeetCode 293: Flip GameA simple string scanning solution for generating every possible next state after flipping one consecutive ++ pair into --.
4 min
LeetCode 294: Flip Game IIA recursive game theory solution with memoization for deciding whether the starting player can force a win.
5 min
LeetCode 295: Find Median from Data StreamA two-heap data structure for adding numbers from a stream and returning the current median in constant time.
5 min
LeetCode 296: Best Meeting PointA median-based solution for minimizing total Manhattan distance in a grid.
6 min
LeetCode 297: Serialize and Deserialize Binary TreeA preorder DFS codec for converting a binary tree to a string and reconstructing the same tree from that string.
5 min
LeetCode 298: Binary Tree Longest Consecutive SequenceA DFS solution for finding the longest parent-to-child path where each node value increases by exactly one.
5 min
LeetCode 299: Bulls and CowsA counting solution for producing the Bulls and Cows hint while handling duplicate digits correctly.
4 min