Skip to content

LeetCode 04xx

LeetCode practice notes for problems 400 through 499, including A clear explanation of finding the nth digit in the infinite integer sequence using digit groups and arithmetic.

#TitleDifficultyDescription
400LeetCode 400: Nth DigitMediumA clear explanation of finding the nth digit in the infinite integer sequence using digit groups and arithmetic.
401LeetCode 401: Binary WatchEasyA clear explanation of the Binary Watch problem using bit counting over all valid times.
402LeetCode 402: Remove K DigitsMediumA clear explanation of the Remove K Digits problem using a greedy monotonic stack.
403LeetCode 403: Frog JumpHardA clear explanation of the Frog Jump problem using dynamic programming with reachable jump sizes.
404LeetCode 404: Sum of Left LeavesEasyA clear explanation of the Sum of Left Leaves problem using depth-first traversal of a binary tree.
405LeetCode 405: Convert a Number to HexadecimalEasyA clear explanation of converting integers to hexadecimal using bit manipulation and two’s complement representation.
406LeetCode 406: Queue Reconstruction by HeightMediumA clear explanation of reconstructing a queue using greedy sorting and indexed insertion.
407LeetCode 407: Trapping Rain Water IIHardA clear explanation of trapping rain water in a 2D elevation map using a min heap and boundary expansion.
408LeetCode 408: Valid Word AbbreviationEasyA clear explanation of validating a word abbreviation using two pointers and number parsing.
409LeetCode 409: Longest PalindromeEasyA clear explanation of finding the longest palindrome length that can be built from given letters using character counts.
410LeetCode 410: Split Array Largest SumHardA clear explanation of minimizing the largest subarray sum using binary search on the answer and greedy validation.
411LeetCode 411: Minimum Unique Word AbbreviationHardA clear explanation of finding the shortest abbreviation that does not conflict with any dictionary word using bit masks.
412LeetCode 412: Fizz BuzzEasyA clear explanation of the Fizz Buzz problem using direct simulation and divisibility checks.
413LeetCode 413: Arithmetic SlicesMediumA clear explanation of counting arithmetic subarrays using dynamic programming and consecutive differences.
414LeetCode 414: Third Maximum NumberEasyA clear explanation of finding the third distinct maximum number using one pass and constant space.
415LeetCode 415: Add StringsEasyA clear explanation of adding two non-negative integer strings using manual digit-by-digit simulation.
416LeetCode 416: Partition Equal Subset SumMediumA clear explanation of deciding whether an array can be split into two equal-sum subsets using 0/1 knapsack dynamic programming.
417LeetCode 417: Pacific Atlantic Water FlowMediumA clear explanation of finding cells that can flow to both oceans using reverse graph traversal from the borders.
418LeetCode 418: Sentence Screen FittingMediumA clear explanation of fitting a sentence onto a screen using cyclic string simulation and greedy row transitions.
419LeetCode 419: Battleships in a BoardMediumA clear explanation of counting battleships in a board using one-pass observation without modifying the grid.
420LeetCode 420: Strong Password CheckerHardA clear explanation of checking the minimum edits needed to make a password strong using greedy handling of length, missing character types, and repeated runs.
421LeetCode 421: Maximum XOR of Two Numbers in an ArrayMediumA clear explanation of finding the maximum XOR of two numbers using greedy bit prefixes.
422LeetCode 422: Valid Word SquareEasyA clear explanation of checking whether rows and columns read the same using direct index comparison.
423LeetCode 423: Reconstruct Original Digits from EnglishMediumA clear explanation of reconstructing digits from shuffled English words using character frequency counts and unique identifying letters.
424LeetCode 424: Longest Repeating Character ReplacementMediumA clear explanation of finding the longest substring that can become all one letter using a sliding window.
425LeetCode 425: Word SquaresHardA clear explanation of building all word squares using backtracking with prefix pruning.
426LeetCode 426: Convert Binary Search Tree to Sorted Doubly Linked ListMediumConvert a BST into a sorted circular doubly linked list in-place using inorder traversal.
427LeetCode 427: Construct Quad TreeMediumBuild a quad tree from a binary square grid using recursive divide and conquer.
428LeetCode 428: Serialize and Deserialize N-ary TreeHardSerialize an N-ary tree into a string and reconstruct the same tree using preorder traversal with child counts.
429LeetCode 429: N-ary Tree Level Order TraversalMediumTraverse an N-ary tree level by level using breadth-first search.
430LeetCode 430: Flatten a Multilevel Doubly Linked ListMediumFlatten a multilevel doubly linked list in-place using depth-first traversal and pointer splicing.
431LeetCode 431: Encode N-ary Tree to Binary TreeHardConvert an N-ary tree into a binary tree and reconstruct it using the left-child right-sibling representation.
432LeetCode 432: All O’one Data StructureHardDesign a data structure that supports increment, decrement, get minimum key, and get maximum key in average O(1) time.
433LeetCode 433: Minimum Genetic MutationMediumFind the minimum number of valid one-character gene mutations using breadth-first search.
434LeetCode 434: Number of Segments in a StringEasyCount the number of word segments in a string by detecting transitions from spaces to non-space characters.
435LeetCode 435: Non-overlapping IntervalsMediumRemove the minimum number of intervals so the remaining intervals do not overlap, using greedy sorting by end time.
436LeetCode 436: Find Right IntervalMediumFind, for each interval, the interval with the smallest start point greater than or equal to its end point using sorting and binary search.
437LeetCode 437: Path Sum IIIMediumCount downward paths in a binary tree whose values sum to targetSum using DFS and prefix sums.
438LeetCode 438: Find All Anagrams in a StringMediumFind all starting indices where an anagram of p appears in s using a fixed-size sliding window.
439LeetCode 439: Ternary Expression ParserMediumEvaluate a nested ternary expression using a right-to-left stack parser.
440LeetCode 440: K-th Smallest in Lexicographical OrderHardFind the k-th integer in lexicographical order without generating all numbers, using prefix counting over a conceptual trie.
441LeetCode 441: Arranging CoinsEasyFind the maximum number of complete staircase rows that can be formed using binary search and triangular numbers.
442LeetCode 442: Find All Duplicates in an ArrayMediumFind all duplicated numbers in an array in O(n) time and O(1) extra space using index marking.
443LeetCode 443: String CompressionMediumCompress a character array in-place using two pointers and grouped character counting.
444LeetCode 444: Sequence ReconstructionMediumCheck whether nums is the unique shortest supersequence of given subsequences using topological sorting.
445LeetCode 445: Add Two Numbers IIMediumAdd two numbers stored in forward-order linked lists using stacks and carry propagation.
446LeetCode 446: Arithmetic Slices II - SubsequenceHardCount arithmetic subsequences of length at least three using dynamic programming with one hash map per ending index.
447LeetCode 447: Number of BoomerangsMediumCount ordered boomerang tuples by fixing each point as the center and grouping other points by squared distance.
448LeetCode 448: Find All Numbers Disappeared in an ArrayEasyFind all missing numbers from 1 to n in O(n) time using in-place index marking.
449LeetCode 449: Serialize and Deserialize BSTMediumSerialize a binary search tree compactly with preorder traversal and rebuild it using BST value bounds.
450LeetCode 450: Delete Node in a BSTMediumDelete a node from a binary search tree while preserving the BST property using recursive search and inorder successor replacement.
451LeetCode 451: Sort Characters By FrequencyMediumA clear explanation of sorting characters by decreasing frequency using a hash map and sorting.
452LeetCode 452: Minimum Number of Arrows to Burst BalloonsMediumA clear explanation of the greedy interval solution for finding the minimum number of arrows needed to burst all balloons.
453LeetCode 453: Minimum Moves to Equal Array ElementsMediumA clear explanation of the math behind making all array elements equal by incrementing n - 1 elements at a time.
454LeetCode 454: 4Sum IIMediumA clear explanation of counting zero-sum tuples across four arrays using pair sums and a hash map.
455LeetCode 455: Assign CookiesEasyA clear explanation of the greedy two-pointer solution for maximizing the number of content children.
456LeetCode 456: 132 PatternMediumA clear explanation of detecting a 132 pattern using reverse traversal and a monotonic stack.
457LeetCode 457: Circular Array LoopMediumA clear explanation of detecting a valid cycle in a circular array using fast and slow pointers.
458LeetCode 458: Poor PigsHardA clear explanation of the combinatorics behind finding the minimum number of pigs needed to identify the poisonous bucket.
459LeetCode 459: Repeated Substring PatternEasyA clear explanation of checking whether a string can be built by repeating one of its proper substrings.
460LeetCode 460: LFU CacheHardA clear explanation of designing an LFU cache with O(1) average get and put operations.
461LeetCode 461: Hamming DistanceEasyA clear explanation of computing the Hamming distance between two integers using XOR and bit counting.
462LeetCode 462: Minimum Moves to Equal Array Elements IIMediumA clear explanation of why the median minimizes the number of moves needed to make all array elements equal.
463LeetCode 463: Island PerimeterEasyA clear explanation of counting the perimeter of an island in a grid by adding land-cell edges and subtracting shared edges.
464LeetCode 464: Can I WinMediumA clear explanation of solving the Can I Win game using minimax recursion, bitmask state compression, and memoization.
465LeetCode 465: Optimal Account BalancingHardA clear explanation of minimizing debt-settlement transactions using net balances, backtracking, and memoization-style pruning.
466LeetCode 466: Count The RepetitionsHardA clear explanation of counting how many repeated copies of one string can be obtained as a subsequence of another repeated string.
467LeetCode 467: Unique Substrings in Wraparound StringMediumA clear explanation of counting unique substrings that appear in the infinite alphabet wraparound string using dynamic programming by ending character.
468LeetCode 468: Validate IP AddressMediumA clear explanation of validating IPv4 and IPv6 addresses by checking segment count, length, characters, range, and leading-zero rules.
469LeetCode 469: Convex PolygonMediumA clear explanation of checking whether ordered points form a convex polygon using cross products.
470LeetCode 470: Implement Rand10() Using Rand7()MediumA clear explanation of generating a uniform random integer from 1 to 10 using only rand7 and rejection sampling.
471LeetCode 471: Encode String with Shortest LengthHardA clear explanation of interval dynamic programming for encoding a string into the shortest k[encoded_string] form.
472LeetCode 472: Concatenated WordsHardA clear explanation of finding all words that can be formed by concatenating at least two shorter words from the same list.
473LeetCode 473: Matchsticks to SquareMediumA clear explanation of deciding whether matchsticks can form a square using backtracking, sorting, and pruning.
474LeetCode 474: Ones and ZeroesMediumA clear explanation of solving the largest subset problem as a two-dimensional 0/1 knapsack over zero and one counts.
475LeetCode 475: HeatersMediumA clear explanation of finding the minimum heater radius by sorting positions and matching each house to its nearest heater.
476LeetCode 476: Number ComplementEasyA clear explanation of finding the bitwise complement of a positive integer using a binary mask.
477LeetCode 477: Total Hamming DistanceMediumA clear explanation of computing the total Hamming distance across all pairs by counting different bits column by column.
478LeetCode 478: Generate Random Point in a CircleMediumA clear explanation of generating uniformly random points inside a circle using polar coordinates.
479LeetCode 479: Largest Palindrome ProductHardA clear explanation of finding the largest palindrome made from the product of two n-digit numbers by generating palindrome candidates directly.
480LeetCode 480: Sliding Window MedianHardA clear explanation of maintaining the median of each fixed-size window using two heaps and lazy deletion.
481LeetCode 481: Magical StringMediumA clear explanation of constructing the magical string by using the string itself as run-length instructions.
482LeetCode 482: License Key FormattingEasyA clear explanation of reformatting a license key by removing dashes, uppercasing characters, and grouping from the right.
483LeetCode 483: Smallest Good BaseHardA clear explanation of finding the smallest base where n is written as all ones using geometric series and binary search.
484LeetCode 484: Find PermutationMediumA clear explanation of constructing the lexicographically smallest permutation that matches an I and D pattern.
485LeetCode 485: Max Consecutive OnesEasyA clear explanation of finding the longest streak of 1s in a binary array with a single pass.
486LeetCode 486: Predict the WinnerMediumA clear explanation of predicting whether Player 1 can win using minimax dynamic programming over score difference.
487LeetCode 487: Max Consecutive Ones IIMediumA clear explanation of finding the longest run of 1s after flipping at most one 0 using a sliding window.
488LeetCode 488: Zuma GameHardA clear explanation of solving Zuma Game with DFS, memoization, and chain-removal simulation.
489LeetCode 489: Robot Room CleanerHardA clear explanation of cleaning an unknown grid using DFS, relative coordinates, and physical backtracking.
490LeetCode 490: The MazeMediumA clear explanation of deciding whether a rolling ball can stop at the destination using BFS or DFS over stopping cells.
491LeetCode 491: Non-decreasing SubsequencesMediumA clear explanation of generating all distinct non-decreasing subsequences using DFS, backtracking, and per-level duplicate control.
492LeetCode 492: Construct the RectangleEasyA clear explanation of finding rectangle dimensions with a fixed area and the smallest length-width difference.
493LeetCode 493: Reverse PairsHardA clear explanation of counting pairs where nums[i] is greater than twice nums[j] using merge sort.
494LeetCode 494: Target SumMediumA clear explanation of counting sign assignments that reach a target using recursion first, then subset-sum dynamic programming.
495LeetCode 495: Teemo AttackingEasyA clear explanation of calculating total poisoned duration by merging overlapping attack intervals.
496LeetCode 496: Next Greater Element IEasyA clear explanation of finding the next greater element using a monotonic decreasing stack and hash map.
497LeetCode 497: Random Point in Non-overlapping RectanglesMediumA clear explanation of uniformly picking an integer point from non-overlapping rectangles using prefix sums and binary search.
498LeetCode 498: Diagonal TraverseMediumA clear explanation of returning matrix elements in diagonal zigzag order by grouping cells with the same row plus column index.
499LeetCode 499: The Maze IIIHardA clear explanation of finding the shortest rolling-ball path to the hole using Dijkstra with lexicographic tie-breaking.
LeetCode 400: Nth DigitA clear explanation of finding the nth digit in the infinite integer sequence using digit groups and arithmetic.
5 min
LeetCode 401: Binary WatchA clear explanation of the Binary Watch problem using bit counting over all valid times.
4 min
LeetCode 402: Remove K DigitsA clear explanation of the Remove K Digits problem using a greedy monotonic stack.
5 min
LeetCode 403: Frog JumpA clear explanation of the Frog Jump problem using dynamic programming with reachable jump sizes.
7 min
LeetCode 404: Sum of Left LeavesA clear explanation of the Sum of Left Leaves problem using depth-first traversal of a binary tree.
4 min
LeetCode 405: Convert a Number to HexadecimalA clear explanation of converting integers to hexadecimal using bit manipulation and two's complement representation.
4 min
LeetCode 406: Queue Reconstruction by HeightA clear explanation of reconstructing a queue using greedy sorting and indexed insertion.
4 min
LeetCode 407: Trapping Rain Water IIA clear explanation of trapping rain water in a 2D elevation map using a min heap and boundary expansion.
7 min
LeetCode 408: Valid Word AbbreviationA clear explanation of validating a word abbreviation using two pointers and number parsing.
5 min
LeetCode 409: Longest PalindromeA clear explanation of finding the longest palindrome length that can be built from given letters using character counts.
5 min
LeetCode 410: Split Array Largest SumA clear explanation of minimizing the largest subarray sum using binary search on the answer and greedy validation.
6 min
LeetCode 411: Minimum Unique Word AbbreviationA clear explanation of finding the shortest abbreviation that does not conflict with any dictionary word using bit masks.
7 min
LeetCode 412: Fizz BuzzA clear explanation of the Fizz Buzz problem using direct simulation and divisibility checks.
4 min
LeetCode 413: Arithmetic SlicesA clear explanation of counting arithmetic subarrays using dynamic programming and consecutive differences.
4 min
LeetCode 414: Third Maximum NumberA clear explanation of finding the third distinct maximum number using one pass and constant space.
5 min
LeetCode 415: Add StringsA clear explanation of adding two non-negative integer strings using manual digit-by-digit simulation.
5 min
LeetCode 416: Partition Equal Subset SumA clear explanation of deciding whether an array can be split into two equal-sum subsets using 0/1 knapsack dynamic programming.
5 min
LeetCode 417: Pacific Atlantic Water FlowA clear explanation of finding cells that can flow to both oceans using reverse graph traversal from the borders.
6 min
LeetCode 418: Sentence Screen FittingA clear explanation of fitting a sentence onto a screen using cyclic string simulation and greedy row transitions.
5 min
LeetCode 419: Battleships in a BoardA clear explanation of counting battleships in a board using one-pass observation without modifying the grid.
5 min
LeetCode 420: Strong Password CheckerA clear explanation of checking the minimum edits needed to make a password strong using greedy handling of length, missing character types, and repeated runs.
7 min
LeetCode 421: Maximum XOR of Two Numbers in an ArrayA clear explanation of finding the maximum XOR of two numbers using greedy bit prefixes.
6 min
LeetCode 422: Valid Word SquareA clear explanation of checking whether rows and columns read the same using direct index comparison.
4 min
LeetCode 423: Reconstruct Original Digits from EnglishA clear explanation of reconstructing digits from shuffled English words using character frequency counts and unique identifying letters.
5 min
LeetCode 424: Longest Repeating Character ReplacementA clear explanation of finding the longest substring that can become all one letter using a sliding window.
5 min
LeetCode 425: Word SquaresA clear explanation of building all word squares using backtracking with prefix pruning.
6 min
LeetCode 426: Convert Binary Search Tree to Sorted Doubly Linked ListConvert a BST into a sorted circular doubly linked list in-place using inorder traversal.
6 min
LeetCode 427: Construct Quad TreeBuild a quad tree from a binary square grid using recursive divide and conquer.
7 min
LeetCode 428: Serialize and Deserialize N-ary TreeSerialize an N-ary tree into a string and reconstruct the same tree using preorder traversal with child counts.
6 min
LeetCode 429: N-ary Tree Level Order TraversalTraverse an N-ary tree level by level using breadth-first search.
5 min
LeetCode 430: Flatten a Multilevel Doubly Linked ListFlatten a multilevel doubly linked list in-place using depth-first traversal and pointer splicing.
6 min
LeetCode 431: Encode N-ary Tree to Binary TreeConvert an N-ary tree into a binary tree and reconstruct it using the left-child right-sibling representation.
5 min
LeetCode 432: All O'one Data StructureDesign a data structure that supports increment, decrement, get minimum key, and get maximum key in average O(1) time.
8 min
LeetCode 433: Minimum Genetic MutationFind the minimum number of valid one-character gene mutations using breadth-first search.
6 min
LeetCode 434: Number of Segments in a StringCount the number of word segments in a string by detecting transitions from spaces to non-space characters.
4 min
LeetCode 435: Non-overlapping IntervalsRemove the minimum number of intervals so the remaining intervals do not overlap, using greedy sorting by end time.
5 min
LeetCode 436: Find Right IntervalFind, for each interval, the interval with the smallest start point greater than or equal to its end point using sorting and binary search.
5 min
LeetCode 437: Path Sum IIICount downward paths in a binary tree whose values sum to targetSum using DFS and prefix sums.
6 min
LeetCode 438: Find All Anagrams in a StringFind all starting indices where an anagram of p appears in s using a fixed-size sliding window.
5 min
LeetCode 439: Ternary Expression ParserEvaluate a nested ternary expression using a right-to-left stack parser.
5 min
LeetCode 440: K-th Smallest in Lexicographical OrderFind the k-th integer in lexicographical order without generating all numbers, using prefix counting over a conceptual trie.
6 min
LeetCode 441: Arranging CoinsFind the maximum number of complete staircase rows that can be formed using binary search and triangular numbers.
4 min
LeetCode 442: Find All Duplicates in an ArrayFind all duplicated numbers in an array in O(n) time and O(1) extra space using index marking.
4 min
LeetCode 443: String CompressionCompress a character array in-place using two pointers and grouped character counting.
4 min
LeetCode 444: Sequence ReconstructionCheck whether nums is the unique shortest supersequence of given subsequences using topological sorting.
6 min
LeetCode 445: Add Two Numbers IIAdd two numbers stored in forward-order linked lists using stacks and carry propagation.
5 min
LeetCode 446: Arithmetic Slices II - SubsequenceCount arithmetic subsequences of length at least three using dynamic programming with one hash map per ending index.
6 min
LeetCode 447: Number of BoomerangsCount ordered boomerang tuples by fixing each point as the center and grouping other points by squared distance.
5 min
LeetCode 448: Find All Numbers Disappeared in an ArrayFind all missing numbers from 1 to n in O(n) time using in-place index marking.
4 min
LeetCode 449: Serialize and Deserialize BSTSerialize a binary search tree compactly with preorder traversal and rebuild it using BST value bounds.
5 min
LeetCode 450: Delete Node in a BSTDelete a node from a binary search tree while preserving the BST property using recursive search and inorder successor replacement.
6 min
LeetCode 451: Sort Characters By FrequencyA clear explanation of sorting characters by decreasing frequency using a hash map and sorting.
5 min
LeetCode 452: Minimum Number of Arrows to Burst BalloonsA clear explanation of the greedy interval solution for finding the minimum number of arrows needed to burst all balloons.
5 min
LeetCode 453: Minimum Moves to Equal Array ElementsA clear explanation of the math behind making all array elements equal by incrementing n - 1 elements at a time.
5 min
LeetCode 454: 4Sum IIA clear explanation of counting zero-sum tuples across four arrays using pair sums and a hash map.
6 min
LeetCode 455: Assign CookiesA clear explanation of the greedy two-pointer solution for maximizing the number of content children.
6 min
LeetCode 456: 132 PatternA clear explanation of detecting a 132 pattern using reverse traversal and a monotonic stack.
6 min
LeetCode 457: Circular Array LoopA clear explanation of detecting a valid cycle in a circular array using fast and slow pointers.
8 min
LeetCode 458: Poor PigsA clear explanation of the combinatorics behind finding the minimum number of pigs needed to identify the poisonous bucket.
6 min
LeetCode 459: Repeated Substring PatternA clear explanation of checking whether a string can be built by repeating one of its proper substrings.
5 min
LeetCode 460: LFU CacheA clear explanation of designing an LFU cache with O(1) average get and put operations.
8 min
LeetCode 461: Hamming DistanceA clear explanation of computing the Hamming distance between two integers using XOR and bit counting.
4 min
LeetCode 462: Minimum Moves to Equal Array Elements IIA clear explanation of why the median minimizes the number of moves needed to make all array elements equal.
6 min
LeetCode 463: Island PerimeterA clear explanation of counting the perimeter of an island in a grid by adding land-cell edges and subtracting shared edges.
6 min
LeetCode 464: Can I WinA clear explanation of solving the Can I Win game using minimax recursion, bitmask state compression, and memoization.
6 min
LeetCode 465: Optimal Account BalancingA clear explanation of minimizing debt-settlement transactions using net balances, backtracking, and memoization-style pruning.
7 min
LeetCode 466: Count The RepetitionsA clear explanation of counting how many repeated copies of one string can be obtained as a subsequence of another repeated string.
8 min
LeetCode 467: Unique Substrings in Wraparound StringA clear explanation of counting unique substrings that appear in the infinite alphabet wraparound string using dynamic programming by ending character.
6 min
LeetCode 468: Validate IP AddressA clear explanation of validating IPv4 and IPv6 addresses by checking segment count, length, characters, range, and leading-zero rules.
7 min
LeetCode 469: Convex PolygonA clear explanation of checking whether ordered points form a convex polygon using cross products.
5 min
LeetCode 470: Implement Rand10() Using Rand7()A clear explanation of generating a uniform random integer from 1 to 10 using only rand7 and rejection sampling.
6 min
LeetCode 471: Encode String with Shortest LengthA clear explanation of interval dynamic programming for encoding a string into the shortest k[encoded_string] form.
6 min
LeetCode 472: Concatenated WordsA clear explanation of finding all words that can be formed by concatenating at least two shorter words from the same list.
6 min
LeetCode 473: Matchsticks to SquareA clear explanation of deciding whether matchsticks can form a square using backtracking, sorting, and pruning.
6 min
LeetCode 474: Ones and ZeroesA clear explanation of solving the largest subset problem as a two-dimensional 0/1 knapsack over zero and one counts.
6 min
LeetCode 475: HeatersA clear explanation of finding the minimum heater radius by sorting positions and matching each house to its nearest heater.
6 min
LeetCode 476: Number ComplementA clear explanation of finding the bitwise complement of a positive integer using a binary mask.
4 min
LeetCode 477: Total Hamming DistanceA clear explanation of computing the total Hamming distance across all pairs by counting different bits column by column.
5 min
LeetCode 478: Generate Random Point in a CircleA clear explanation of generating uniformly random points inside a circle using polar coordinates.
6 min
LeetCode 479: Largest Palindrome ProductA clear explanation of finding the largest palindrome made from the product of two n-digit numbers by generating palindrome candidates directly.
6 min
LeetCode 480: Sliding Window MedianA clear explanation of maintaining the median of each fixed-size window using two heaps and lazy deletion.
7 min
LeetCode 481: Magical StringA clear explanation of constructing the magical string by using the string itself as run-length instructions.
5 min
LeetCode 482: License Key FormattingA clear explanation of reformatting a license key by removing dashes, uppercasing characters, and grouping from the right.
4 min
LeetCode 483: Smallest Good BaseA clear explanation of finding the smallest base where n is written as all ones using geometric series and binary search.
6 min
LeetCode 484: Find PermutationA clear explanation of constructing the lexicographically smallest permutation that matches an I and D pattern.
5 min
LeetCode 485: Max Consecutive OnesA clear explanation of finding the longest streak of 1s in a binary array with a single pass.
4 min
LeetCode 486: Predict the WinnerA clear explanation of predicting whether Player 1 can win using minimax dynamic programming over score difference.
6 min
LeetCode 487: Max Consecutive Ones IIA clear explanation of finding the longest run of 1s after flipping at most one 0 using a sliding window.
5 min
LeetCode 488: Zuma GameA clear explanation of solving Zuma Game with DFS, memoization, and chain-removal simulation.
7 min
LeetCode 489: Robot Room CleanerA clear explanation of cleaning an unknown grid using DFS, relative coordinates, and physical backtracking.
8 min
LeetCode 490: The MazeA clear explanation of deciding whether a rolling ball can stop at the destination using BFS or DFS over stopping cells.
6 min
LeetCode 491: Non-decreasing SubsequencesA clear explanation of generating all distinct non-decreasing subsequences using DFS, backtracking, and per-level duplicate control.
5 min
LeetCode 492: Construct the RectangleA clear explanation of finding rectangle dimensions with a fixed area and the smallest length-width difference.
4 min
LeetCode 493: Reverse PairsA clear explanation of counting pairs where nums[i] is greater than twice nums[j] using merge sort.
6 min
LeetCode 494: Target SumA clear explanation of counting sign assignments that reach a target using recursion first, then subset-sum dynamic programming.
6 min
LeetCode 495: Teemo AttackingA clear explanation of calculating total poisoned duration by merging overlapping attack intervals.
4 min
LeetCode 496: Next Greater Element IA clear explanation of finding the next greater element using a monotonic decreasing stack and hash map.
5 min
LeetCode 497: Random Point in Non-overlapping RectanglesA clear explanation of uniformly picking an integer point from non-overlapping rectangles using prefix sums and binary search.
6 min
LeetCode 498: Diagonal TraverseA clear explanation of returning matrix elements in diagonal zigzag order by grouping cells with the same row plus column index.
5 min
LeetCode 499: The Maze IIIA clear explanation of finding the shortest rolling-ball path to the hole using Dijkstra with lexicographic tie-breaking.
7 min