LeetCode 09xx

LeetCode practice notes for problems 900 through 999, including A clear explanation of designing an iterator over a run-length encoded sequence without expanding it.

100 items

LeetCode 09xx

# Title Difficulty Description
900 LeetCode 900: RLE Iterator Medium A clear explanation of designing an iterator over a run-length encoded sequence without expanding it.
901 LeetCode 901: Online Stock Span Medium A clear explanation of Online Stock Span using a monotonic decreasing stack with accumulated spans.
902 LeetCode 902: Numbers At Most N Given Digit Set Hard A clear explanation of counting numbers less than or equal to N using digit-by-digit construction and combinatorics.
903 LeetCode 903: Valid Permutations for DI Sequence Hard A clear explanation of counting valid DI permutations using dynamic programming and prefix sums.
904 LeetCode 904: Fruit Into Baskets Medium A clear explanation of Fruit Into Baskets using a sliding window with at most two distinct fruit types.
905 LeetCode 905: Sort Array By Parity Easy A clear explanation of sorting an array by parity using a two-pointer partition method.
906 LeetCode 906: Super Palindromes Hard A clear explanation of counting super-palindromes by generating palindromic roots and checking their squares.
907 LeetCode 907: Sum of Subarray Minimums Medium A clear explanation of summing subarray minimums using a monotonic stack and contribution counting.
908 LeetCode 908: Smallest Range I Easy A clear explanation of minimizing an array score after each value can move by at most k.
909 LeetCode 909: Snakes and Ladders Medium A clear explanation of Snakes and Ladders using breadth-first search over board squares.
910 LeetCode 910: Smallest Range II Medium A clear explanation of minimizing the array range after adding either +k or -k to every element.
911 LeetCode 911: Online Election Medium A clear explanation of Online Election using preprocessing and binary search over vote times.
912 LeetCode 912: Sort an Array Medium A clear explanation of sorting an array without built-in sorting using merge sort.
913 LeetCode 913: Cat and Mouse Hard A clear explanation of Cat and Mouse using game states, reverse BFS, and topological propagation.
914 LeetCode 914: X of a Kind in a Deck of Cards Easy A clear explanation of checking whether card counts share a common group size using the greatest common divisor.
915 LeetCode 915: Partition Array into Disjoint Intervals Medium A clear explanation of finding the smallest left partition using prefix maximums and suffix minimums.
916 LeetCode 916: Word Subsets Medium A clear explanation of finding universal words by merging character frequency requirements from words2.
917 LeetCode 917: Reverse Only Letters Easy A clear explanation of reversing only English letters while keeping all non-letter characters fixed.
918 LeetCode 918: Maximum Sum Circular Subarray Medium A clear explanation of finding the maximum circular subarray sum using Kadane's algorithm.
919 LeetCode 919: Complete Binary Tree Inserter Medium A clear explanation of maintaining a complete binary tree inserter using level-order indexing.
920 LeetCode 920: Number of Music Playlists Hard A clear explanation of counting valid music playlists using dynamic programming over playlist length and unique songs used.
921 LeetCode 921: Minimum Add to Make Parentheses Valid Medium A clear explanation of making a parentheses string valid using greedy counting.
922 LeetCode 922: Sort Array By Parity II Easy A clear explanation of placing even numbers at even indices and odd numbers at odd indices using two pointers.
923 LeetCode 923: 3Sum With Multiplicity Medium A clear explanation of counting index triplets with duplicate values using frequency counts and combinatorics.
924 LeetCode 924: Minimize Malware Spread Hard A clear explanation of minimizing malware spread by analyzing connected components with Union Find.
925 LeetCode 925: Long Pressed Name Easy A clear explanation of the Long Pressed Name problem using a two-pointer scan.
926 LeetCode 926: Flip String to Monotone Increasing Medium A clear explanation of solving Flip String to Monotone Increasing with a one-pass dynamic programming approach.
927 LeetCode 927: Three Equal Parts Hard A clear explanation of solving Three Equal Parts by counting ones, locating the three binary patterns, and comparing them in one pass.
928 LeetCode 928: Minimize Malware Spread II Hard A clear explanation of solving Minimize Malware Spread II by removing each infected node and simulating the final malware spread.
929 LeetCode 929: Unique Email Addresses Easy A clear explanation of solving Unique Email Addresses using string normalization and a hash set.
930 LeetCode 930: Binary Subarrays With Sum Medium A clear explanation of solving Binary Subarrays With Sum using prefix sums and a frequency map.
931 LeetCode 931: Minimum Falling Path Sum Medium A clear explanation of solving Minimum Falling Path Sum using dynamic programming over matrix rows.
932 LeetCode 932: Beautiful Array Medium A clear explanation of solving Beautiful Array using divide and conquer with odd and even transformations.
933 LeetCode 933: Number of Recent Calls Easy A clear explanation of solving Number of Recent Calls using a queue as a sliding time window.
934 LeetCode 934: Shortest Bridge Medium A clear explanation of solving Shortest Bridge using DFS to mark one island and BFS to expand toward the other island.
935 LeetCode 935: Knight Dialer Medium A clear explanation of solving Knight Dialer using dynamic programming over the phone keypad graph.
936 LeetCode 936: Stamping The Sequence Hard A clear explanation of solving Stamping The Sequence using reverse simulation and BFS-style processing.
937 LeetCode 937: Reorder Data in Log Files Easy A clear explanation of solving Reorder Data in Log Files using custom sorting and stable handling of digit logs.
938 LeetCode 938: Range Sum of BST Easy A clear explanation of solving Range Sum of BST using DFS with binary search tree pruning.
939 LeetCode 939: Minimum Area Rectangle Medium A clear explanation of solving Minimum Area Rectangle using diagonal point pairs and constant-time point lookup.
940 LeetCode 940: Distinct Subsequences II Hard A clear explanation of solving Distinct Subsequences II using dynamic programming and last occurrence tracking.
941 LeetCode 941: Valid Mountain Array Easy A clear explanation of solving Valid Mountain Array by walking up the increasing slope and then down the decreasing slope.
942 LeetCode 942: DI String Match Easy A clear explanation of solving DI String Match using a greedy two-pointer construction.
943 LeetCode 943: Find the Shortest Superstring Hard A clear explanation of solving Find the Shortest Superstring using pairwise overlaps and bitmask dynamic programming.
944 LeetCode 944: Delete Columns to Make Sorted Easy A clear explanation of solving Delete Columns to Make Sorted by checking each column independently.
945 LeetCode 945: Minimum Increment to Make Array Unique Medium A clear explanation of solving Minimum Increment to Make Array Unique by sorting and greedily assigning the next available value.
946 LeetCode 946: Validate Stack Sequences Medium A clear explanation of solving Validate Stack Sequences by simulating stack push and pop operations.
947 LeetCode 947: Most Stones Removed with Same Row or Column Medium A clear explanation of solving Most Stones Removed with Same Row or Column using connected components and union-find.
948 LeetCode 948: Bag of Tokens Medium A clear explanation of solving Bag of Tokens using sorting, greedy choices, and two pointers.
949 LeetCode 949: Largest Time for Given Digits Medium A clear explanation of solving Largest Time for Given Digits by checking all permutations of four digits.
950 LeetCode 950: Reveal Cards In Increasing Order Medium A clear explanation of solving Reveal Cards In Increasing Order using sorting and queue simulation over indices.
951 LeetCode 951: Flip Equivalent Binary Trees Medium A clear explanation of checking whether two binary trees are equivalent after swapping left and right children at any number of nodes.
952 LeetCode 952: Largest Component Size by Common Factor Hard A clear explanation of solving Largest Component Size by Common Factor using prime factorization and union find.
953 LeetCode 953: Verifying an Alien Dictionary Easy A clear explanation of checking whether words are sorted according to a custom alien alphabet order.
954 LeetCode 954: Array of Doubled Pairs Medium A clear explanation of checking whether an array can be reordered into pairs where one number is double the other.
955 LeetCode 955: Delete Columns to Make Sorted II Medium A clear explanation of deleting the minimum number of columns so rows become lexicographically sorted.
956 LeetCode 956: Tallest Billboard Hard A clear explanation of solving Tallest Billboard using dynamic programming over height differences.
957 LeetCode 957: Prison Cells After N Days Medium A clear explanation of simulating prison cell transitions efficiently using cycle detection.
958 LeetCode 958: Check Completeness of a Binary Tree Medium A clear explanation of checking whether a binary tree is complete using level-order traversal.
959 LeetCode 959: Regions Cut By Slashes Medium A clear explanation of counting regions formed by slashes using union find over four triangles per cell.
960 LeetCode 960: Delete Columns to Make Sorted III Hard A clear explanation of deleting the minimum number of columns so every remaining row is individually sorted.
961 LeetCode 961: N-Repeated Element in Size 2N Array Easy A clear explanation of finding the element repeated N times using a hash set.
962 LeetCode 962: Maximum Width Ramp Medium A clear explanation of finding the maximum width ramp using a monotonic decreasing stack.
963 LeetCode 963: Minimum Area Rectangle II Medium A clear explanation of finding the minimum-area rectangle from points when the rectangle may be rotated.
964 LeetCode 964: Least Operators to Express Number Hard A clear explanation of expressing a target using the fewest operators with repeated uses of x.
965 LeetCode 965: Univalued Binary Tree Easy A clear explanation of checking whether every node in a binary tree has the same value.
966 LeetCode 966: Vowel Spellchecker Medium A clear explanation of implementing a spellchecker with exact, case-insensitive, and vowel-error matching.
967 LeetCode 967: Numbers With Same Consecutive Differences Medium A clear explanation of generating all n-digit numbers whose adjacent digits differ by k.
968 LeetCode 968: Binary Tree Cameras Hard A clear explanation of placing the minimum number of cameras in a binary tree using postorder DFS.
969 LeetCode 969: Pancake Sorting Medium A clear explanation of sorting an array using prefix reversals by repeatedly placing the largest remaining value.
970 LeetCode 970: Powerful Integers Medium A clear explanation of generating all powerful integers using bounded powers and a set.
971 LeetCode 971: Flip Binary Tree To Match Preorder Traversal Medium A clear explanation of matching a binary tree preorder traversal by greedily flipping nodes.
972 LeetCode 972: Equal Rational Numbers Hard A clear explanation of comparing rational numbers written as decimal strings with optional repeating parts.
973 LeetCode 973: K Closest Points to Origin Medium A clear explanation of returning the k closest points to the origin using squared distance and sorting.
974 LeetCode 974: Subarray Sums Divisible by K Medium A clear explanation of counting subarrays whose sum is divisible by k using prefix sums and remainder frequencies.
975 LeetCode 975: Odd Even Jump Hard A clear explanation of counting good starting indices using next-jump preprocessing and dynamic programming.
976 LeetCode 976: Largest Perimeter Triangle Easy A clear explanation of finding the largest valid triangle perimeter using sorting and a greedy scan.
977 LeetCode 977: Squares of a Sorted Array Easy A clear explanation of sorting squared values from a sorted array using two pointers.
978 LeetCode 978: Longest Turbulent Subarray Medium A clear explanation of finding the longest subarray whose adjacent comparisons alternate between greater-than and less-than.
979 LeetCode 979: Distribute Coins in Binary Tree Medium A clear explanation of balancing coins in a binary tree using postorder DFS and subtree coin balance.
980 LeetCode 980: Unique Paths III Hard A clear explanation of counting all paths from start to end that visit every non-obstacle square exactly once using backtracking.
981 LeetCode 981: Time Based Key-Value Store Medium A clear explanation of designing a time-based key-value store using a hash map and binary search.
982 LeetCode 982: Triples with Bitwise AND Equal To Zero Hard A clear explanation of counting ordered triples whose bitwise AND is zero using pairwise AND counts.
983 LeetCode 983: Minimum Cost For Tickets Medium A clear explanation of finding the cheapest way to cover all travel days using dynamic programming.
984 LeetCode 984: String Without AAA or BBB Medium A clear explanation of constructing a string with exact counts of a and b while avoiding three equal consecutive characters.
985 LeetCode 985: Sum of Even Numbers After Queries Medium A clear explanation of maintaining the sum of even numbers after each array update.
986 LeetCode 986: Interval List Intersections Medium A clear explanation of finding intersections between two sorted disjoint interval lists using two pointers.
987 LeetCode 987: Vertical Order Traversal of a Binary Tree Hard A clear explanation of vertical tree traversal using coordinates, DFS, sorting, and column grouping.
988 LeetCode 988: Smallest String Starting From Leaf Medium A clear explanation of finding the lexicographically smallest leaf-to-root string in a binary tree using DFS.
989 LeetCode 989: Add to Array-Form of Integer Easy A clear explanation of adding an integer to an array-form number using digit-by-digit simulation.
990 LeetCode 990: Satisfiability of Equality Equations Medium A clear explanation of checking equality and inequality constraints using union-find.
991 LeetCode 991: Broken Calculator Medium A clear explanation of finding the minimum operations by working backward from target to startValue.
992 LeetCode 992: Subarrays with K Different Integers Hard A clear explanation of counting subarrays with exactly k distinct integers using the at-most-k sliding window trick.
993 LeetCode 993: Cousins in Binary Tree Easy A clear explanation of checking whether two binary tree nodes are cousins using BFS with parent tracking.
994 LeetCode 994: Rotting Oranges Medium A clear explanation of finding the minimum time for all oranges to rot using multi-source BFS.
995 LeetCode 995: Minimum Number of K Consecutive Bit Flips Hard A clear explanation of making all bits equal to 1 using greedy left-to-right flips and a sliding window flip parity.
996 LeetCode 996: Number of Squareful Arrays Hard A clear explanation of counting unique permutations where every adjacent pair sums to a perfect square using backtracking.
997 LeetCode 997: Find the Town Judge Easy A clear explanation of identifying the town judge using trust indegree and outdegree counts.
998 LeetCode 998: Maximum Binary Tree II Medium A clear explanation of inserting a value into a maximum binary tree by following the right spine.
999 LeetCode 999: Available Captures for Rook Easy A clear explanation of counting how many pawns a rook can capture by scanning four directions on a chessboard.