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.

100 items

LeetCode 04xx

# Title Difficulty Description
400 LeetCode 400: Nth Digit Medium A clear explanation of finding the nth digit in the infinite integer sequence using digit groups and arithmetic.
401 LeetCode 401: Binary Watch Easy A clear explanation of the Binary Watch problem using bit counting over all valid times.
402 LeetCode 402: Remove K Digits Medium A clear explanation of the Remove K Digits problem using a greedy monotonic stack.
403 LeetCode 403: Frog Jump Hard A clear explanation of the Frog Jump problem using dynamic programming with reachable jump sizes.
404 LeetCode 404: Sum of Left Leaves Easy A clear explanation of the Sum of Left Leaves problem using depth-first traversal of a binary tree.
405 LeetCode 405: Convert a Number to Hexadecimal Easy A clear explanation of converting integers to hexadecimal using bit manipulation and two's complement representation.
406 LeetCode 406: Queue Reconstruction by Height Medium A clear explanation of reconstructing a queue using greedy sorting and indexed insertion.
407 LeetCode 407: Trapping Rain Water II Hard A clear explanation of trapping rain water in a 2D elevation map using a min heap and boundary expansion.
408 LeetCode 408: Valid Word Abbreviation Easy A clear explanation of validating a word abbreviation using two pointers and number parsing.
409 LeetCode 409: Longest Palindrome Easy A clear explanation of finding the longest palindrome length that can be built from given letters using character counts.
410 LeetCode 410: Split Array Largest Sum Hard A clear explanation of minimizing the largest subarray sum using binary search on the answer and greedy validation.
411 LeetCode 411: Minimum Unique Word Abbreviation Hard A clear explanation of finding the shortest abbreviation that does not conflict with any dictionary word using bit masks.
412 LeetCode 412: Fizz Buzz Easy A clear explanation of the Fizz Buzz problem using direct simulation and divisibility checks.
413 LeetCode 413: Arithmetic Slices Medium A clear explanation of counting arithmetic subarrays using dynamic programming and consecutive differences.
414 LeetCode 414: Third Maximum Number Easy A clear explanation of finding the third distinct maximum number using one pass and constant space.
415 LeetCode 415: Add Strings Easy A clear explanation of adding two non-negative integer strings using manual digit-by-digit simulation.
416 LeetCode 416: Partition Equal Subset Sum Medium A clear explanation of deciding whether an array can be split into two equal-sum subsets using 0/1 knapsack dynamic programming.
417 LeetCode 417: Pacific Atlantic Water Flow Medium A clear explanation of finding cells that can flow to both oceans using reverse graph traversal from the borders.
418 LeetCode 418: Sentence Screen Fitting Medium A clear explanation of fitting a sentence onto a screen using cyclic string simulation and greedy row transitions.
419 LeetCode 419: Battleships in a Board Medium A clear explanation of counting battleships in a board using one-pass observation without modifying the grid.
420 LeetCode 420: Strong Password Checker Hard A clear explanation of checking the minimum edits needed to make a password strong using greedy handling of length, missing character types, and repeated runs.
421 LeetCode 421: Maximum XOR of Two Numbers in an Array Medium A clear explanation of finding the maximum XOR of two numbers using greedy bit prefixes.
422 LeetCode 422: Valid Word Square Easy A clear explanation of checking whether rows and columns read the same using direct index comparison.
423 LeetCode 423: Reconstruct Original Digits from English Medium A clear explanation of reconstructing digits from shuffled English words using character frequency counts and unique identifying letters.
424 LeetCode 424: Longest Repeating Character Replacement Medium A clear explanation of finding the longest substring that can become all one letter using a sliding window.
425 LeetCode 425: Word Squares Hard A clear explanation of building all word squares using backtracking with prefix pruning.
426 LeetCode 426: Convert Binary Search Tree to Sorted Doubly Linked List Medium Convert a BST into a sorted circular doubly linked list in-place using inorder traversal.
427 LeetCode 427: Construct Quad Tree Medium Build a quad tree from a binary square grid using recursive divide and conquer.
428 LeetCode 428: Serialize and Deserialize N-ary Tree Hard Serialize an N-ary tree into a string and reconstruct the same tree using preorder traversal with child counts.
429 LeetCode 429: N-ary Tree Level Order Traversal Medium Traverse an N-ary tree level by level using breadth-first search.
430 LeetCode 430: Flatten a Multilevel Doubly Linked List Medium Flatten a multilevel doubly linked list in-place using depth-first traversal and pointer splicing.
431 LeetCode 431: Encode N-ary Tree to Binary Tree Hard Convert an N-ary tree into a binary tree and reconstruct it using the left-child right-sibling representation.
432 LeetCode 432: All O'one Data Structure Hard Design a data structure that supports increment, decrement, get minimum key, and get maximum key in average O(1) time.
433 LeetCode 433: Minimum Genetic Mutation Medium Find the minimum number of valid one-character gene mutations using breadth-first search.
434 LeetCode 434: Number of Segments in a String Easy Count the number of word segments in a string by detecting transitions from spaces to non-space characters.
435 LeetCode 435: Non-overlapping Intervals Medium Remove the minimum number of intervals so the remaining intervals do not overlap, using greedy sorting by end time.
436 LeetCode 436: Find Right Interval Medium Find, for each interval, the interval with the smallest start point greater than or equal to its end point using sorting and binary search.
437 LeetCode 437: Path Sum III Medium Count downward paths in a binary tree whose values sum to targetSum using DFS and prefix sums.
438 LeetCode 438: Find All Anagrams in a String Medium Find all starting indices where an anagram of p appears in s using a fixed-size sliding window.
439 LeetCode 439: Ternary Expression Parser Medium Evaluate a nested ternary expression using a right-to-left stack parser.
440 LeetCode 440: K-th Smallest in Lexicographical Order Hard Find the k-th integer in lexicographical order without generating all numbers, using prefix counting over a conceptual trie.
441 LeetCode 441: Arranging Coins Easy Find the maximum number of complete staircase rows that can be formed using binary search and triangular numbers.
442 LeetCode 442: Find All Duplicates in an Array Medium Find all duplicated numbers in an array in O(n) time and O(1) extra space using index marking.
443 LeetCode 443: String Compression Medium Compress a character array in-place using two pointers and grouped character counting.
444 LeetCode 444: Sequence Reconstruction Medium Check whether nums is the unique shortest supersequence of given subsequences using topological sorting.
445 LeetCode 445: Add Two Numbers II Medium Add two numbers stored in forward-order linked lists using stacks and carry propagation.
446 LeetCode 446: Arithmetic Slices II - Subsequence Hard Count arithmetic subsequences of length at least three using dynamic programming with one hash map per ending index.
447 LeetCode 447: Number of Boomerangs Medium Count ordered boomerang tuples by fixing each point as the center and grouping other points by squared distance.
448 LeetCode 448: Find All Numbers Disappeared in an Array Easy Find all missing numbers from 1 to n in O(n) time using in-place index marking.
449 LeetCode 449: Serialize and Deserialize BST Medium Serialize a binary search tree compactly with preorder traversal and rebuild it using BST value bounds.
450 LeetCode 450: Delete Node in a BST Medium Delete a node from a binary search tree while preserving the BST property using recursive search and inorder successor replacement.
451 LeetCode 451: Sort Characters By Frequency Medium A clear explanation of sorting characters by decreasing frequency using a hash map and sorting.
452 LeetCode 452: Minimum Number of Arrows to Burst Balloons Medium A clear explanation of the greedy interval solution for finding the minimum number of arrows needed to burst all balloons.
453 LeetCode 453: Minimum Moves to Equal Array Elements Medium A clear explanation of the math behind making all array elements equal by incrementing n - 1 elements at a time.
454 LeetCode 454: 4Sum II Medium A clear explanation of counting zero-sum tuples across four arrays using pair sums and a hash map.
455 LeetCode 455: Assign Cookies Easy A clear explanation of the greedy two-pointer solution for maximizing the number of content children.
456 LeetCode 456: 132 Pattern Medium A clear explanation of detecting a 132 pattern using reverse traversal and a monotonic stack.
457 LeetCode 457: Circular Array Loop Medium A clear explanation of detecting a valid cycle in a circular array using fast and slow pointers.
458 LeetCode 458: Poor Pigs Hard A clear explanation of the combinatorics behind finding the minimum number of pigs needed to identify the poisonous bucket.
459 LeetCode 459: Repeated Substring Pattern Easy A clear explanation of checking whether a string can be built by repeating one of its proper substrings.
460 LeetCode 460: LFU Cache Hard A clear explanation of designing an LFU cache with O(1) average get and put operations.
461 LeetCode 461: Hamming Distance Easy A clear explanation of computing the Hamming distance between two integers using XOR and bit counting.
462 LeetCode 462: Minimum Moves to Equal Array Elements II Medium A clear explanation of why the median minimizes the number of moves needed to make all array elements equal.
463 LeetCode 463: Island Perimeter Easy A clear explanation of counting the perimeter of an island in a grid by adding land-cell edges and subtracting shared edges.
464 LeetCode 464: Can I Win Medium A clear explanation of solving the Can I Win game using minimax recursion, bitmask state compression, and memoization.
465 LeetCode 465: Optimal Account Balancing Hard A clear explanation of minimizing debt-settlement transactions using net balances, backtracking, and memoization-style pruning.
466 LeetCode 466: Count The Repetitions Hard A clear explanation of counting how many repeated copies of one string can be obtained as a subsequence of another repeated string.
467 LeetCode 467: Unique Substrings in Wraparound String Medium A clear explanation of counting unique substrings that appear in the infinite alphabet wraparound string using dynamic programming by ending character.
468 LeetCode 468: Validate IP Address Medium A clear explanation of validating IPv4 and IPv6 addresses by checking segment count, length, characters, range, and leading-zero rules.
469 LeetCode 469: Convex Polygon Medium A clear explanation of checking whether ordered points form a convex polygon using cross products.
470 LeetCode 470: Implement Rand10() Using Rand7() Medium A clear explanation of generating a uniform random integer from 1 to 10 using only rand7 and rejection sampling.
471 LeetCode 471: Encode String with Shortest Length Hard A clear explanation of interval dynamic programming for encoding a string into the shortest k[encoded_string] form.
472 LeetCode 472: Concatenated Words Hard A clear explanation of finding all words that can be formed by concatenating at least two shorter words from the same list.
473 LeetCode 473: Matchsticks to Square Medium A clear explanation of deciding whether matchsticks can form a square using backtracking, sorting, and pruning.
474 LeetCode 474: Ones and Zeroes Medium A clear explanation of solving the largest subset problem as a two-dimensional 0/1 knapsack over zero and one counts.
475 LeetCode 475: Heaters Medium A clear explanation of finding the minimum heater radius by sorting positions and matching each house to its nearest heater.
476 LeetCode 476: Number Complement Easy A clear explanation of finding the bitwise complement of a positive integer using a binary mask.
477 LeetCode 477: Total Hamming Distance Medium A clear explanation of computing the total Hamming distance across all pairs by counting different bits column by column.
478 LeetCode 478: Generate Random Point in a Circle Medium A clear explanation of generating uniformly random points inside a circle using polar coordinates.
479 LeetCode 479: Largest Palindrome Product Hard A clear explanation of finding the largest palindrome made from the product of two n-digit numbers by generating palindrome candidates directly.
480 LeetCode 480: Sliding Window Median Hard A clear explanation of maintaining the median of each fixed-size window using two heaps and lazy deletion.
481 LeetCode 481: Magical String Medium A clear explanation of constructing the magical string by using the string itself as run-length instructions.
482 LeetCode 482: License Key Formatting Easy A clear explanation of reformatting a license key by removing dashes, uppercasing characters, and grouping from the right.
483 LeetCode 483: Smallest Good Base Hard A clear explanation of finding the smallest base where n is written as all ones using geometric series and binary search.
484 LeetCode 484: Find Permutation Medium A clear explanation of constructing the lexicographically smallest permutation that matches an I and D pattern.
485 LeetCode 485: Max Consecutive Ones Easy A clear explanation of finding the longest streak of 1s in a binary array with a single pass.
486 LeetCode 486: Predict the Winner Medium A clear explanation of predicting whether Player 1 can win using minimax dynamic programming over score difference.
487 LeetCode 487: Max Consecutive Ones II Medium A clear explanation of finding the longest run of 1s after flipping at most one 0 using a sliding window.
488 LeetCode 488: Zuma Game Hard A clear explanation of solving Zuma Game with DFS, memoization, and chain-removal simulation.
489 LeetCode 489: Robot Room Cleaner Hard A clear explanation of cleaning an unknown grid using DFS, relative coordinates, and physical backtracking.
490 LeetCode 490: The Maze Medium A clear explanation of deciding whether a rolling ball can stop at the destination using BFS or DFS over stopping cells.
491 LeetCode 491: Non-decreasing Subsequences Medium A clear explanation of generating all distinct non-decreasing subsequences using DFS, backtracking, and per-level duplicate control.
492 LeetCode 492: Construct the Rectangle Easy A clear explanation of finding rectangle dimensions with a fixed area and the smallest length-width difference.
493 LeetCode 493: Reverse Pairs Hard A clear explanation of counting pairs where nums[i] is greater than twice nums[j] using merge sort.
494 LeetCode 494: Target Sum Medium A clear explanation of counting sign assignments that reach a target using recursion first, then subset-sum dynamic programming.
495 LeetCode 495: Teemo Attacking Easy A clear explanation of calculating total poisoned duration by merging overlapping attack intervals.
496 LeetCode 496: Next Greater Element I Easy A clear explanation of finding the next greater element using a monotonic decreasing stack and hash map.
497 LeetCode 497: Random Point in Non-overlapping Rectangles Medium A clear explanation of uniformly picking an integer point from non-overlapping rectangles using prefix sums and binary search.
498 LeetCode 498: Diagonal Traverse Medium A clear explanation of returning matrix elements in diagonal zigzag order by grouping cells with the same row plus column index.
499 LeetCode 499: The Maze III Hard A clear explanation of finding the shortest rolling-ball path to the hole using Dijkstra with lexicographic tie-breaking.