LeetCode 08xx
LeetCode practice notes for problems 800 through 899, including A clear explanation of finding the closest shorthand RGB color by rounding each color channel to the nearest repeated hexadecimal pair.
LeetCode 08xx
| # | Title | Difficulty | Description |
|---|---|---|---|
| 800 | LeetCode 800: Similar RGB Color | Easy | A clear explanation of finding the closest shorthand RGB color by rounding each color channel to the nearest repeated hexadecimal pair. |
| 801 | LeetCode 801: Minimum Swaps To Make Sequences Increasing | Medium | A dynamic programming solution for finding the minimum number of same-index swaps needed to make two arrays strictly increasing. |
| 802 | LeetCode 802: Find Eventual Safe States | Medium | A graph traversal solution for finding all nodes that cannot reach a directed cycle. |
| 803 | LeetCode 803: Bricks Falling When Hit | Hard | A reverse simulation and union-find solution for counting how many bricks fall after each hit. |
| 804 | LeetCode 804: Unique Morse Code Words | Easy | A set-based solution for counting how many different Morse code transformations appear among a list of words. |
| 805 | LeetCode 805: Split Array With Same Average | Hard | A dynamic programming solution for deciding whether an array can be split into two non-empty groups with the same average. |
| 806 | LeetCode 806: Number of Lines To Write String | Easy | A simple simulation solution for counting how many 100-pixel lines are needed to write a string. |
| 807 | LeetCode 807: Max Increase to Keep City Skyline | Medium | A greedy solution for increasing building heights as much as possible while preserving every skyline view. |
| 808 | LeetCode 808: Soup Servings | Medium | A probability dynamic programming solution for computing whether soup A empties before soup B, with an early return for large input. |
| 809 | LeetCode 809: Expressive Words | Medium | A two-pointer group comparison solution for counting how many words can be stretched to match a target string. |
| 810 | LeetCode 810: Chalkboard XOR Game | Hard | A math and bit manipulation solution for deciding whether Alice wins the XOR removal game. |
| 811 | LeetCode 811: Subdomain Visit Count | Medium | A hash map solution for accumulating visit counts across domains and all of their parent subdomains. |
| 812 | LeetCode 812: Largest Triangle Area | Easy | A geometry solution for finding the largest triangle area by checking every triplet of points with the cross product formula. |
| 813 | LeetCode 813: Largest Sum of Averages | Medium | A dynamic programming and prefix sum solution for partitioning an array into adjacent groups with maximum total average. |
| 814 | LeetCode 814: Binary Tree Pruning | Medium | A postorder DFS solution for removing every binary tree subtree that does not contain a 1. |
| 815 | LeetCode 815: Bus Routes | Hard | A BFS solution for finding the minimum number of buses needed to travel from a source stop to a target stop. |
| 816 | LeetCode 816: Ambiguous Coordinates | Medium | An enumeration solution for reconstructing all valid coordinate pairs after commas, spaces, and decimal points were removed. |
| 817 | LeetCode 817: Linked List Components | Medium | A hash set and linked list traversal solution for counting consecutive components whose values appear in nums. |
| 818 | LeetCode 818: Race Car | Hard | A dynamic programming solution for finding the shortest instruction sequence that drives a race car to the target position. |
| 819 | LeetCode 819: Most Common Word | Easy | A hash map and string parsing solution for finding the most frequent non-banned word in a paragraph. |
| 820 | LeetCode 820: Short Encoding of Words | Medium | A suffix-removal solution for finding the shortest reference string that can encode every word. |
| 821 | LeetCode 821: Shortest Distance to a Character | Easy | A two-pass solution for computing the shortest distance from each index to the nearest occurrence of a target character. |
| 822 | LeetCode 822: Card Flipping Game | Medium | A hash set solution for finding the smallest number that can be hidden from all front-facing cards. |
| 823 | LeetCode 823: Binary Trees With Factors | Medium | A dynamic programming solution for counting binary trees where every non-leaf node is the product of its children. |
| 824 | LeetCode 824: Goat Latin | Easy | A string simulation solution for converting each word in a sentence into Goat Latin. |
| 825 | LeetCode 825: Friends Of Appropriate Ages | Medium | A counting solution for computing how many directed friend requests are allowed by age rules. |
| 826 | LeetCode 826: Most Profit Assigning Work | Medium | A clear explanation of the Most Profit Assigning Work problem using sorting, greedy choice, and two pointers. |
| 827 | LeetCode 827: Making A Large Island | Hard | A clear explanation of the Making A Large Island problem using connected component labeling and island size lookup. |
| 828 | LeetCode 828: Count Unique Characters of All Substrings of a Given String | Hard | A clear explanation of Count Unique Characters of All Substrings using contribution counting with previous and next occurrences. |
| 829 | LeetCode 829: Consecutive Numbers Sum | Hard | A clear explanation of the Consecutive Numbers Sum problem using arithmetic series formulas and divisibility analysis. |
| 830 | LeetCode 830: Positions of Large Groups | Easy | A clear explanation of the Positions of Large Groups problem using a simple two-pointer scan. |
| 831 | LeetCode 831: Masking Personal Information | Medium | A clear explanation of the Masking Personal Information problem using string parsing and format-specific masking rules. |
| 832 | LeetCode 832: Flipping an Image | Easy | A clear explanation of the Flipping an Image problem using row reversal, bit inversion, and an in-place two-pointer method. |
| 833 | LeetCode 833: Find And Replace in String | Medium | A clear explanation of the Find And Replace in String problem using simultaneous replacement, source matching, and a replacement map. |
| 834 | LeetCode 834: Sum of Distances in Tree | Hard | A clear explanation of the Sum of Distances in Tree problem using tree DP, subtree sizes, and rerooting. |
| 835 | LeetCode 835: Image Overlap | Medium | A clear explanation of the Image Overlap problem using translation vectors and frequency counting. |
| 836 | LeetCode 836: Rectangle Overlap | Easy | A clear explanation of the Rectangle Overlap problem using axis projections and positive intersection area. |
| 837 | LeetCode 837: New 21 Game | Medium | A clear explanation of the New 21 Game problem using probability dynamic programming and a sliding window sum. |
| 838 | LeetCode 838: Push Dominoes | Medium | A clear explanation of the Push Dominoes problem using force propagation and a two-pass scan. |
| 839 | LeetCode 839: Similar String Groups | Hard | A clear explanation of the Similar String Groups problem using graph connectivity and union-find. |
| 840 | LeetCode 840: Magic Squares In Grid | Medium | A clear explanation of the Magic Squares In Grid problem using fixed-size subgrid validation. |
| 841 | LeetCode 841: Keys and Rooms | Medium | A clear explanation of the Keys and Rooms problem using graph traversal from room 0. |
| 842 | LeetCode 842: Split Array into Fibonacci Sequence | Medium | A clear explanation of the Split Array into Fibonacci Sequence problem using backtracking, leading-zero checks, and 32-bit integer limits. |
| 843 | LeetCode 843: Guess the Word | Hard | A clear explanation of the Guess the Word interactive problem using candidate filtering and minimax-style guessing. |
| 844 | LeetCode 844: Backspace String Compare | Easy | A clear explanation of the Backspace String Compare problem using stack simulation and an O(1) space two-pointer scan. |
| 845 | LeetCode 845: Longest Mountain in Array | Medium | A clear explanation of the Longest Mountain in Array problem using peak detection and two-pointer expansion. |
| 846 | LeetCode 846: Hand of Straights | Medium | A clear explanation of the Hand of Straights problem using sorting, frequency counting, and greedy grouping. |
| 847 | LeetCode 847: Shortest Path Visiting All Nodes | Hard | A clear explanation of the Shortest Path Visiting All Nodes problem using multi-source BFS and bitmask state compression. |
| 848 | LeetCode 848: Shifting Letters | Medium | A clear explanation of the Shifting Letters problem using suffix sums and modulo arithmetic. |
| 849 | LeetCode 849: Maximize Distance to Closest Person | Medium | A clear explanation of the Maximize Distance to Closest Person problem using gaps between occupied seats. |
| 850 | LeetCode 850: Rectangle Area II | Hard | A clear explanation of the Rectangle Area II problem using sweep line and merged active y-intervals. |
| 851 | LeetCode 851: Loud and Rich | Medium | A clear explanation of Loud and Rich using graph traversal, DFS, and memoization. |
| 852 | LeetCode 852: Peak Index in a Mountain Array | Medium | A clear explanation of finding the peak index in a mountain array using binary search. |
| 853 | LeetCode 853: Car Fleet | Medium | A clear explanation of counting car fleets by sorting cars by position and tracking arrival times. |
| 854 | LeetCode 854: K-Similar Strings | Hard | A clear explanation of finding the minimum number of swaps needed to transform one anagram string into another using BFS. |
| 855 | LeetCode 855: Exam Room | Medium | A clear explanation of simulating an exam room by maintaining occupied seats in sorted order. |
| 856 | LeetCode 856: Score of Parentheses | Medium | A clear explanation of scoring a balanced parentheses string using depth counting. |
| 857 | LeetCode 857: Minimum Cost to Hire K Workers | Hard | A clear explanation of hiring exactly k workers with minimum total cost using wage-to-quality ratios, sorting, and a max heap. |
| 858 | LeetCode 858: Mirror Reflection | Medium | A clear explanation of Mirror Reflection using room unfolding, least common multiples, and parity. |
| 859 | LeetCode 859: Buddy Strings | Easy | A clear explanation of checking whether one swap in a string can make it equal to another string. |
| 860 | LeetCode 860: Lemonade Change | Easy | A clear explanation of Lemonade Change using greedy simulation and bill counting. |
| 861 | LeetCode 861: Score After Flipping Matrix | Medium | A clear explanation of maximizing a binary matrix score using greedy row and column flips. |
| 862 | LeetCode 862: Shortest Subarray with Sum at Least K | Hard | A clear explanation of finding the shortest non-empty subarray with sum at least k using prefix sums and a monotonic deque. |
| 863 | LeetCode 863: All Nodes Distance K in Binary Tree | Medium | A clear explanation of finding all binary tree nodes at distance k from a target node by treating the tree as an undirected graph. |
| 864 | LeetCode 864: Shortest Path to Get All Keys | Hard | A clear explanation of finding the minimum moves to collect all keys in a grid using BFS with key bitmasks. |
| 865 | LeetCode 865: Smallest Subtree with all the Deepest Nodes | Medium | A clear explanation of finding the smallest subtree that contains all deepest nodes using bottom-up DFS. |
| 866 | LeetCode 866: Prime Palindrome | Medium | A clear explanation of finding the smallest prime palindrome greater than or equal to n by generating odd-length palindromes and testing primality. |
| 867 | LeetCode 867: Transpose Matrix | Easy | A clear explanation of transposing a matrix by swapping row and column indices. |
| 868 | LeetCode 868: Binary Gap | Easy | A clear explanation of finding the maximum distance between adjacent set bits in a binary representation. |
| 869 | LeetCode 869: Reordered Power of 2 | Medium | A clear explanation of checking whether the digits of a number can be reordered to form a power of two using digit frequency signatures. |
| 870 | LeetCode 870: Advantage Shuffle | Medium | A clear explanation of maximizing the advantage of one array over another using sorting, greedy matching, and two pointers. |
| 871 | LeetCode 871: Minimum Number of Refueling Stops | Hard | A clear explanation of minimizing refueling stops using a greedy max heap over reachable stations. |
| 872 | LeetCode 872: Leaf-Similar Trees | Easy | A clear explanation of comparing two binary trees by collecting their leaf value sequences with DFS. |
| 873 | LeetCode 873: Length of Longest Fibonacci Subsequence | Medium | A clear explanation of finding the longest Fibonacci-like subsequence using dynamic programming and value-to-index lookup. |
| 874 | LeetCode 874: Walking Robot Simulation | Medium | A clear explanation of simulating robot movement on an infinite grid using direction vectors and obstacle lookup. |
| 875 | LeetCode 875: Koko Eating Bananas | Medium | A clear explanation of finding the minimum banana-eating speed using binary search on the answer. |
| 876 | LeetCode 876: Middle of the Linked List | Easy | A clear explanation of finding the middle node of a singly linked list using slow and fast pointers. |
| 877 | LeetCode 877: Stone Game | Medium | A clear explanation of the Stone Game problem using game theory and interval dynamic programming. |
| 878 | LeetCode 878: Nth Magical Number | Hard | A clear explanation of finding the nth magical number using binary search, greatest common divisor, least common multiple, and inclusion-exclusion. |
| 879 | LeetCode 879: Profitable Schemes | Hard | A clear explanation of counting profitable crime schemes using 0/1 knapsack dynamic programming with members and profit states. |
| 880 | LeetCode 880: Decoded String at Index | Medium | A clear explanation of finding the kth character in a decoded string without building the full decoded string. |
| 881 | LeetCode 881: Boats to Save People | Medium | A clear explanation of minimizing rescue boats using sorting, greedy choice, and two pointers. |
| 882 | LeetCode 882: Reachable Nodes In Subdivided Graph | Hard | A clear explanation of counting reachable original and subdivided nodes using Dijkstra's shortest path algorithm. |
| 883 | LeetCode 883: Projection Area of 3D Shapes | Easy | A clear explanation of computing the projection areas of stacked cubes from top, front, and side views. |
| 884 | LeetCode 884: Uncommon Words from Two Sentences | Easy | A clear explanation of finding uncommon words by counting word frequencies across both sentences. |
| 885 | LeetCode 885: Spiral Matrix III | Medium | A clear explanation of generating grid coordinates in an outward clockwise spiral using simulation. |
| 886 | LeetCode 886: Possible Bipartition | Medium | A clear explanation of checking whether people can be split into two groups using graph coloring and bipartite graph detection. |
| 887 | LeetCode 887: Super Egg Drop | Hard | A clear explanation of finding the minimum worst-case number of moves using dynamic programming over eggs and moves. |
| 888 | LeetCode 888: Fair Candy Swap | Easy | A clear explanation of finding one candy box swap that makes Alice and Bob have equal total candies. |
| 889 | LeetCode 889: Construct Binary Tree from Preorder and Postorder Traversal | Medium | A clear explanation of reconstructing a binary tree from preorder and postorder traversals using recursion and index ranges. |
| 890 | LeetCode 890: Find and Replace Pattern | Medium | A clear explanation of finding words that match a pattern using bijective character mapping. |
| 891 | LeetCode 891: Sum of Subsequence Widths | Hard | A clear explanation of summing subsequence widths by sorting and counting each element as a maximum and minimum. |
| 892 | LeetCode 892: Surface Area of 3D Shapes | Easy | A clear explanation of computing the exposed surface area of stacked cubes by adding tower area and subtracting shared faces. |
| 893 | LeetCode 893: Groups of Special-Equivalent Strings | Medium | A clear explanation of counting special-equivalent string groups by building canonical signatures from even and odd positions. |
| 894 | LeetCode 894: All Possible Full Binary Trees | Medium | A clear explanation of generating all full binary trees with n nodes using recursion and memoization. |
| 895 | LeetCode 895: Maximum Frequency Stack | Hard | A clear explanation of designing a stack that pops the most frequent value, breaking ties by most recent insertion. |
| 896 | LeetCode 896: Monotonic Array | Easy | A clear explanation of checking whether an array is monotonic using one pass and direction flags. |
| 897 | LeetCode 897: Increasing Order Search Tree | Easy | A clear explanation of rearranging a binary search tree into an increasing right-only tree using inorder traversal. |
| 898 | LeetCode 898: Bitwise ORs of Subarrays | Medium | A clear explanation of counting distinct bitwise OR results from all non-empty subarrays using rolling sets. |
| 899 | LeetCode 899: Orderly Queue | Hard | A clear explanation of finding the lexicographically smallest string after queue operations using rotation and sorting. |