Skip to content

Latest commit

 

History

History
1341 lines (1340 loc) · 431 KB

leetcode_repo_readme.md

File metadata and controls

1341 lines (1340 loc) · 431 KB

| ID | Title | Solutions | Video | Difficulty | Tag | Company |------|----------------|------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|-------------|------------- | 2264 |Largest 3-Same-Digit Number in String| Java || Easy || | 2260 |Minimum Consecutive Cards to Pick Up| Java || Medium || | 2259 |Remove Digit From Number to Maximize Result| Java || Easy || | 2256 |Minimum Average Difference| Java || Medium || | 2255 |Count Prefixes of a Given String| Java || Easy || | 2248 |Intersection of Multiple Arrays| Java || Easy || | 2244 |Minimum Rounds to Complete All Tasks| Java || Medium || | 2243 |Calculate Digit Sum of a String| Java || Easy || | 2239 |Find Closest Number to Zero| Java || Easy || | 2236 |Root Equals Sum of Children| Java || Easy || | 223 |Root Equals Sum of Children| Java || Easy || | 2220 |Minimum Bit Flips to Convert Number| Java || Easy || | 2215 |Find the Difference of Two Arrays| Java || Easy || | 2210 |Count Hills and Valleys in an Array| Java || Easy || | 2208 |Minimum Operations to Halve Array Sum| Java || Medium || | 2206 |Divide Array Into Equal Pairs| Java || Easy || | 2201 |Count Artifacts That Can Be Extracted| Java || Medium || | 2200 |Find All K-Distant Indices in an Array| Java || Easy || | 2194 |Cells in a Range on an Excel Sheet| Java || Easy || | 2190 |Most Frequent Number Following Key In an Array| Java || Easy || | 2186 |Minimum Number of Steps to Make Two Strings Anagram II| Java || Medium || | 2185 |Counting Words With a Given Prefix| Java || Easy || | 2182 |Construct String With Repeat Limit| Java || Medium || | 2181 |Merge Nodes in Between Zeros| Java || Medium || | 2180 |Count Integers With Even Digit Sum| Java || Easy || | 2177 |Find Three Consecutive Integers That Sum to a Given Number| Java || Medium || | 2176 |Count Equal and Divisible Pairs in an Array| Java || Easy || | 2169 |Count Operations to Obtain Zero| Java || Easy || | 2166 |Design Bitset| Java || Medium || | 2165 |Smallest Value of the Rearranged Number| Java || Medium || | 2164 |Sort Even and Odd Indices Independently| Java || Easy || | 2161 |Partition Array According to Given Pivot| Java || Medium || | 2160 |Minimum Sum of Four Digit Number After Splitting Digits| Java || Easy || | 2156 |Find Substring With Given Hash Value| Java || Medium || | 2155 |All Divisions With the Highest Score of a Binary Array| Java || Medium || | 2154 |Keep Multiplying Found Values by Two| Java || Easy || | 2150 |Find All Lonely Numbers in the Array| Java || Medium || | 2149 |Rearrange Array Elements by Sign| Java || Medium || | 2148 |Count Elements With Strictly Smaller and Greater Elements| Java || Easy || | 2144 |Minimum Cost of Buying Candies With Discount| Java || Easy || | 2139 |Minimum Moves to Reach Target Score| Java || Medium || | 2138 |Divide a String Into Groups of Size k| Java || Easy || | 2134 |Minimum Swaps to Group All 1's Together II| Java || Medium || | 2133 |Check if Every Row and Column Contains All Numbers| Java || Easy || | 2130 |Maximum Twin Sum of a Linked List| Java || Medium || | 2129 |Capitalize the Title| Java || Easy || | 2126 |Destroying Asteroids| Java || Medium || | 2125 |Number of Laser Beams in a Bank| Java || Medium || | 2124 |Check if All A's Appears Before All B's| Java || Easy || | 2120 |Execution of All Suffix Instructions Staying in a Grid| Java || Medium || | 2119 |A Number After a Double Reversal| Java || Easy || | 2116 |Check if a Parentheses String Can Be Valid| Java || Medium || | 2114 |Maximum Number of Words Found in Sentences| Java || Easy || | 2110 |Number of Smooth Descent Periods of a Stock| Java || Medium || | 2109 |Adding Spaces to a String| Java || Medium || | 2108 |Find First Palindromic String in the Array| Java || Easy || | 2103 |Rings and Rods| Java || Easy || | 2099 |Find Subsequence of Length K With the Largest Sum| Java || Easy || | 2095 |Delete the Middle Node of a Linked List| Java || Medium || | 2094 |Finding 3-Digit Even Numbers| Java || Easy || | 2091 |Removing Minimum and Maximum From Array| Java || Medium || | 2090 |K Radius Subarray Averages| Java || Medium || | 2089 |Find Target Indices After Sorting Array| Java || Easy || | 2086 |Minimum Number of Buckets Required to Collect Rainwater from Houses| Java || Medium || | 2085 |Count Common Words With One Occurrence| Java || Easy || | 2080 |Range Frequency Queries| Java || Medium |Array, Binary Search| | 2079 |Watering Plants| Java || Medium || | 2078 |Two Furthest Houses With Different Colors| Java || Easy || | 2076 |Process Restricted Friend Requests| Java || Hard || | 2075 |Decode the Slanted Ciphertext| Java || Medium || | 2074 |Reverse Nodes in Even Length Groups| Java || Medium || | 2073 |Time Needed to Buy Tickets| Java || Easy || | 2070 |Most Beautiful Item for Each Query| Java || Medium || | 2068 |Check Whether Two Strings are Almost Equivalent| Java || Easy || | 2063 |Vowels of All Substrings| Java || Medium || | 2062 |Count Vowel Substrings of a String| Java || Easy || | 2058 |Find the Minimum and Maximum Number of Nodes Between Critical Points| Java || Medium || | 2057 |Smallest Index With Equal Value| Java || Easy || | 2055 |Plates Between Candles| Java || Medium || | 2054 |Two Best Non-Overlapping Events| Java || Medium || | 2053 |Kth Distinct String in an Array| Java || Easy || | 2050 |Parallel Courses III| Java || Hard || | 2048 |Next Greater Numerically Balanced Number| Java || Medium || | 2047 |Number of Valid Words in a Sentence| Java || Easy || | 2044 |Count Number of Maximum Bitwise-OR Subsets| Java || Medium || | 2043 |Simple Bank System| Java || Medium || | 2042 |Check if Numbers Are Ascending in a Sentence| Java || Easy || | 2039 |The Time When the Network Becomes Idle| Java || Medium || | 2038 |Remove Colored Pieces if Both Neighbors are the Same Color| Java || Medium || | 2037 |Minimum Number of Moves to Seat Everyone| Java || Easy || | 2034 |Stock Price Fluctuation| Java || Medium || | 2033 |Minimum Operations to Make a Uni-Value Grid| Java || Medium || | 2032 |Two Out of Three| Java || Easy || | 2028 |Find Missing Observations| Java || Medium || | 2027 |Minimum Moves to Convert String| Java || Easy || | 2024 |Maximize the Confusion of an Exam| Java || Medium || | 2023 |Number of Pairs of Strings With Concatenation Equal to Target| Java || Medium || | 2022 |Convert 1D Array Into 2D Array| Java || Easy || | 2018 |Check if Word Can Be Placed In Crossword| Java || Medium || | 2017 |Grid Game| Java || Medium |Array, Matrix, Prefix Sum| | 2016 |Maximum Difference Between Increasing Elements| Java || Easy || | 2012 |Sum of Beauty in the Array| Java || Medium || | 2011 |Final Value of Variable After Performing Operations| Java || Easy || | 2007 |Find Original Array From Doubled Array| Java || Medium || | 2006 |Count Number of Pairs With Absolute Difference K| Java || Easy || | 2001 |Number of Pairs of Interchangeable Rectangles| Python3, Java || Medium || | 2000 |Reverse Prefix of Word| Solution || Easy || | 1996 |The Number of Weak Characters in the Game| Solution || Medium || | 1995 |Count Special Quadruplets| Solution || Easy || | 1992 |Find All Groups of Farmland| Solution || Medium || | 1991 |Find the Middle Index in Array| Solution || Easy || | 1985 |Find the Kth Largest Integer in the Array| Solution || Medium || | 1984 |Minimum Difference Between Highest and Lowest of K Scores| Solution || Easy || | 1981 |Minimize the Difference Between Target and Chosen Elements| Solution || Medium |DP| | 1980 |Find Unique Binary String| Solution || Medium || | 1979 |Find Greatest Common Divisor of Array| Solution || Easy || | 1974 |Minimum Time to Type Word Using Special Typewriter| Solution || Easy || | 1971 |Find if Path Exists in Graph| Solution || Easy |BFS, DFS, Graph| | 1968 |Array With Elements Not Equal to Average of Neighbors| Solution || Medium || | 1967 |Number of Strings That Appear as Substrings in Word| Solution || Easy || | 1966 |Binary Searchable Numbers in an Unsorted Array| Solution || Medium |Array, Binary Search| | 1961 |Check If String Is a Prefix of Array| Solution || Easy || | 1957 |Delete Characters to Make Fancy String| Solution || Easy |String| | 1952 |Three Divisors| Solution || Easy || | 1945 |Sum of Digits of String After Convert| Solution || Easy || | 1941 |Check if All Characters Have Equal Number of Occurrences| Solution || Easy || | 1936 |Add Minimum Number of Rungs| Solution || Medium || | 1935 |Maximum Number of Words You Can Type| Solution || Easy |String| | 1933 |Check if String Is Decomposable Into Value-Equal Substrings| Solution || Easy |String| | 1929 |Concatenation of Array| Solution || Easy || | 1926 |Nearest Exit from Entrance in Maze| Solution || Medium |DP, DFS, BFS| | 1925 |Count Square Sum Triples| Solution || Easy |Array, Greedy| | 1920 |Build Array from Permutation| Solution || Easy || | 1913 |Maximum Product Difference Between Two Pairs| Solution || Easy |Sort| | 1910 |Remove All Occurrences of a Substring| Solution | 📺 |Medium|String| | 1909 |Remove One Element to Make the Array Strictly Increasing| Solution || Easy |Array| | 1904 |The Number of Full Rounds You Have Played| Solution || Medium |String, Greedy| | 1903 |Largest Odd Number in String| Solution | 📺 |Easy|Greedy| | 1897 |Redistribute Characters to Make All Strings Equal| Solution || Easy |String, Greedy| | 1893 |Check if All the Integers in a Range Are Covered| Solution || Easy |Array, HashTable, Prefix Sum| | 1891 |Cutting Ribbons| Solution || Medium |Array, Binary Search| | 1886 |Determine Whether Matrix Can Be Obtained By Rotation| Solution || Easy |Array| | 1880 |Check if Word Equals Summation of Two Words| Solution || Easy |String| | 1877 |Minimize Maximum Pair Sum in Array| Solution || Medium |Greedy, Sort| | 1876 |Substrings of Size Three with Distinct Characters| Solution || Easy |String| | 1874 |Minimize Product Sum of Two Arrays| Solution || Medium |Array, Greedy, Sorting| | 1869 |Longer Contiguous Segments of Ones than Zeros| Solution || Easy |Array, Two Pointers| | 1863 |Sum of All Subset XOR Totals| Solution || Easy |Backtracking, Recursion| | 1862 |Sum of Floored Pairs| Solution || Hard |Math| | 1861 |Rotating the Box| Solution | 📺 |Medium|Array, Two Pointers| | 1860 |Incremental Memory Leak| Solution || Medium |Math| | 1859 |Sorting the Sentence| Solution || Easy |String, Sort| | 1854 |Maximum Population Year| Solution || Easy |Array| | 1848 |Minimum Distance to the Target Element| Solution || Easy |Array| | 1845 |Seat Reservation Manager| Solution || Medium |Heap, Design| | 1844 |Replace All Digits with Characters| Solution || Easy |String| | 1837 |Sum of Digits in Base K| Solution || Easy |Math, Bit Manipulation| | 1836 |Remove Duplicates From an Unsorted Linked List| Solution || Medium |HashTable, LinkedList| | 1833 |Maximum Ice Cream Bars| Solution || Medium |Array, Sort| | 1832 |Check if the Sentence Is Pangram| Solution || Easy |String| | 1829 |Maximum XOR for Each Query| Solution || Medium |Bit Manipulation| | 1828 |Queries on Number of Points Inside a Circle| Solution | 📺 |Medium|Math| | 1827 |Minimum Operations to Make the Array Increasing| Solution || Easy |Array, Greedy| | 1826 |Faulty Sensor| Solution || Easy |Array, Two Pointers| | 1823 |Find the Winner of the Circular Game| Solution || Medium |Array| | 1822 |Sign of the Product of an Array| Solution || Easy |Math| | 1817 |Finding the Users Active Minutes| Solution || Medium |HashTable| | 1816 |Truncate Sentence| Solution || Easy |String| | 1814 |Count Nice Pairs in an Array| Solution || Medium |Array, HashTable| | 1813 |Sentence Similarity III| Solution | 📺 |Medium|String| | 1812 |Determine Color of a Chessboard Square| Solution || Easy |String| | 1807 |Evaluate the Bracket Pairs of a String| Solution || Medium |HashTable, String| | 1806 |Minimum Number of Operations to Reinitialize a Permutation| Solution || Medium |Array, Greedy| | 1805 |Number of Different Integers in a String| Solution || Medium |String| | 1804 |Implement Trie II (Prefix Tree)| Solution || Medium |Trie, Design| | 1800 |Maximum Ascending Subarray Sum| Solution || Easy |Two Pointers| | 1797 |Design Authentication Manager| Solution || Medium |HashTable, Design| | 1796 |Second Largest Digit in a String| Solution || Easy |String| | 1792 |Maximum Average Pass Ratio| Solution || Medium |Heap| | 1791 |Find Center of Star Graph| Solution || Medium |Graph| | 1790 |Check if One String Swap Can Make Strings Equal| Solution || Easy |String| | 1785 |Minimum Elements to Add to Form a Given Sum| Solution || Medium |Greedy| | 1784 |Check if Binary String Has at Most One Segment of Ones| Solution || Easy |Greedy| | 1781 |Sum of Beauty of All Substrings| Solution || Medium |HashTable, String| | 1780 |Check if Number is a Sum of Powers of Three| Solution || Medium |Math, Backtracking, Recursion| | 1779 |Find Nearest Point That Has the Same X or Y Coordinate| Solution || Easy |Array| | 1775 |Equal Sum Arrays With Minimum Number of Operations| Solution || Medium |Greedy| | 1774 |Closest Dessert Cost| Solution || Medium |Greedy| | 1773 |Count Items Matching a Rule| Solution | 📺 |Easy|Array, String| | 1772 |Sort Features by Popularity| Solution | 📺 |Medium|HashTable, Sort| | 1769 |Minimum Number of Operations to Move All Balls to Each Box| Solution || Medium |Array, Greedy| | 1768 |Merge Strings Alternately| Solution || Easy |String| | 1765 |Map of Highest Peak| Solution || Medium |BFS, Graph| | 1764 |Form Array by Concatenating Subarrays of Another Array| Solution || Medium |Array, Greedy| | 1763 |Longest Nice Substring| Solution || Easy |String| | 1759 |Count Number of Homogenous Substrings| Solution || Medium |String ,Greedy| | 1758 |Minimum Changes To Make Alternating Binary String| Solution || Easy |Greedy, Array| | 1756 |Design Most Recently Used Queue| Solution || Medium |Array, Design, Dequeue| | 1754 |Largest Merge Of Two Strings| Solution || Medium |Greedy, Suffix Array| | 1753 |Maximum Score From Removing Stones| Solution || Medium |Math, Heap| | 1752 |Check if Array Is Sorted and Rotated| Solution || Easy |Array| | 1750 |Minimum Length of String After Deleting Similar Ends| Solution || Medium |Two Pointers| | 1749 |Maximum Absolute Sum of Any Subarray| Solution || Medium |Greedy| | 1748 |Sum of Unique Elements| Solution || Easy |Array, HashTable| | 1746 |Maximum Subarray Sum After One Operation| Solution || Medium |DP| | 1745 |Palindrome Partitioning IV| Solution || Hard |String, DP| | 1743 |Restore the Array From Adjacent Pairs| Solution || Medium |Greedy| | 1742 |Maximum Number of Balls in a Box| Solution || Easy |Array| | 1736 |Latest Time by Replacing Hidden Digits| Solution || Easy |String, Greedy| | 1733 |Minimum Number of People to Teach| Solution || Medium |Array, Greedy| | 1732 |Find the Highest Altitude| Solution || Easy |Array| | 1727 |Largest Submatrix With Rearrangements| Solution || Medium |Greedy, Sort| | 1726 |Tuple with Same Product| Solution | 📺 |Medium|Array| | 1725 |Number Of Rectangles That Can Form The Largest Square| Solution || Easy |Greedy| | 1721 |Swapping Nodes in a Linked List| Solution || Medium |LinkedList| | 1720 |Decode XORed Array| Solution || Easy |Bit Manipulation| | 1718 |Construct the Lexicographically Largest Valid Sequence| Solution || Medium |Backtracking, Recursion| | 1717 |Maximum Score From Removing Substrings| Solution | 📺 |Medium|Greedy| | 1716 |Calculate Money in Leetcode Bank| Solution || Easy |Math, Greedy| | 1711 |Count Good Meals| Solution || Medium |Array, HashTable, Two Pointers| | 1710 |Maximum Units on a Truck| Solution || Easy |Greedy, Sort| | 1708 |Largest Subarray Length K| Solution || Easy |Array, Greedy| | 1705 |Maximum Number of Eaten Apples| Solution || Medium |Heap, Greedy| | 1704 |Determine if String Halves Are Alike| Solution || Easy |String| | 1700 |Number of Students Unable to Eat Lunch| Solution || Easy |Array| | 1695 |Maximum Erasure Value| Solution || Medium |Two Pointers| | 1694 |Reformat Phone Number| Solution || Easy |String| | 1690 |Stone Game VII| Solution || Medium |DP| | 1689 |Partitioning Into Minimum Number Of Deci-Binary Numbers| Solution || Medium |Greedy| | 1688 |Count of Matches in Tournament| Solution || Easy |Backtracking| | 1686 |Stone Game VI| Solution || Medium |Greedy| | 1685 |Sum of Absolute Differences in a Sorted Array| Solution | 📺 |Medium|Math, Greedy| | 1684 |Count the Number of Consistent Strings| Solution || Easy |String| | 1680 |Concatenation of Consecutive Binary Numbers| Solution || Medium |Math| | 1679 |Max Number of K-Sum Pairs| Solution || Medium |HashTable| | 1678 |Goal Parser Interpretation| Solution || Easy |String| | 1676 |Lowest Common Ancestor of a Binary Tree IV| Solution || Medium |Tree, DFS, Binary Tree| | 1675 |Minimize Deviation in Array| Solution || Hard |Heap, Ordered Map| | 1673 |Find the Most Competitive Subsequence| Solution | 📺 |Medium|Stack, Greedy| | 1672 |Richest Customer Wealth| Solution || Easy |Array| | 1670 |Design Front Middle Back Queue| Solution || Medium |Linked List, Design, Dequeu| | 1669 |Merge In Between Linked Lists| Solution || Medium |LinedList| | 1668 |Maximum Repeating Substring| Solution || Easy |String| | 1664 |Ways to Make a Fair Array| Javascript || Medium |Greedy| | 1663 |Smallest String With A Given Numeric Value| Solution | 📺 |Medium|Greedy| | 1662 |Check If Two String Arrays are Equivalent| Solution || Easy |String| | 1658 |Minimum Operations to Reduce X to Zero| Javascript, Java || Medium |Greedy| | 1657 |Determine if Two Strings Are Close| Solution | 📺 |Medium|Greedy| | 1656 |Design an Ordered Stream| Solution || Easy |Array, Design| | 1652 |Defuse the Bomb| Solution || Easy |Array| | 1650 |Lowest Common Ancestor of a Binary Tree III| Solution || Medium |HashTable, Binary Tree, Tree| | 1646 |Get Maximum in Generated Array| Solution || Easy |Array| | 1644 |Lowest Common Ancestor of a Binary Tree II| Solution || Medium |Binary Tree, DFS| | 1642 |Furthest Building You Can Reach| Solution || Medium |Binary Search, Heap| | 1641 |Count Sorted Vowel Strings| Solution | 📺 |Medium|Math, DP, Backtracking| | 1640 |Check Array Formation Through Concatenation| Solution || Easy |Array, Sort| | 1637 |Widest Vertical Area Between Two Points Containing No Points| Javascript, Java | | Medium | Sort | | 1636 |Sort Array by Increasing Frequency| Solution || Easy |Array, Sort| | 1630 |Arithmetic Subarrays| Solution || Medium |Sort| | 1629 |Slowest Key| Solution || Easy |Array| | 1628 |Design an Expression Tree With Evaluate Function| Solution || Medium |Stack, Binary Tree, Design, Math| | 1626 |Best Team With No Conflicts| Solution || Medium |DP| | 1625 |Lexicographically Smallest String After Applying Operations| Solution || Medium |BFS, DFS| | 1624 |Largest Substring Between Two Equal Characters| Solution | 📺 |Easy|String| | 1620 |Coordinate With Maximum Network Quality| Solution | 📺 |Medium|Greedy| | 1619 |Mean of Array After Removing Some Elements| Solution | 📺 |Easy|Array| | 1614 |Maximum Nesting Depth of the Parentheses| Solution || Easy |String| | 1609 |Even Odd Tree| Solution || Medium |Tree| | 1608 |Special Array With X Elements Greater Than or Equal X| Solution || Easy |Array| | 1604 |Alert Using Same Key-Card Three or More Times in a One Hour Period| Solution || Medium |String, Ordered Map| | 1603 |Design Parking System| Solution || Easy |Design| | 1601 |Maximum Number of Achievable Transfer Requests| Solution || Hard |Backtracking| | 1598 |Crawler Log Folder| Solution || Easy |Stack| | 1592 |Rearrange Spaces Between Words| Solution || Easy |String| | 1588 |Sum of All Odd Length Subarrays| Solution || Easy |Array| | 1583 |Count Unhappy Friends| Solution || Medium |Array| | 1582 |Special Positions in a Binary Matrix| Solution || Easy |Array| | 1577 |Number of Ways Where Square of Number Is Equal to Product of Two Numbers| Solution || Medium |HashTable, Math| | 1576 |Replace All ?'s to Avoid Consecutive Repeating Characters| Solution | 📺 |Easy|String| | 1574 |Shortest Subarray to be Removed to Make Array Sorted| Solution || Medium |Array, Binary Search| | 1572 |Matrix Diagonal Sum| Solution || Easy |Array| | 1570 |Dot Product of Two Sparse Vectors| Solution || Easy |Array, HashTable, Two Pointers| | 1567 |Maximum Length of Subarray With Positive Product| Solution | 📺 |Medium|Greedy| | 1566 |Detect Pattern of Length M Repeated K or More Times| Solution | 📺 |Easy|Array| | 1561 |Maximum Number of Coins You Can Get| Solution | 📺 |Medium|Sort| | 1560 |Most Visited Sector in a Circular Track| Solution || Easy |Array| | 1558 |Minimum Numbers of Function Calls to Make Target Array| Solution || Medium |Greedy| | 1557 |Minimum Number of Vertices to Reach All Nodes| Solution | 📺 |Medium|Graph| | 1556 |Thousand Separator| Solution | 📺 |Easy|String| | 1551 |Minimum Operations to Make Array Equal| Solution | 📺 |Medium|Math| | 1550 |Three Consecutive Odds| Solution | |Easy|Array| | 1545 |Find Kth Bit in Nth Binary String| Solution | 📺 |Medium|String| | 1544 |Make The String Great| Solution | 📺 |Easy|String, Stack| | 1541 |Minimum Insertions to Balance a Parentheses String| Solution | 📺 |Medium|String, Stack| | 1539 |Kth Missing Positive Number| Solution | 📺 |Easy|Array, HashTable| | 1535 |Find the Winner of an Array Game| Solution | 📺 |Medium|Array| | 1534 |Count Good Triplets| Solution | |Easy|Array| | 1528 |Shuffle String| Solution | |Easy|Sort| | 1526 |Minimum Number of Increments on Subarrays to Form a Target Array| Solution | |Hard|Segment Tree| | 1525 |Number of Good Ways to Split a String| Solution | 📺 |Medium|String, Bit Manipulation| | 1524 |Number of Sub-arrays With Odd Sum| Solution | |Medium|Array, Math| | 1523 |Count Odd Numbers in an Interval Range| Solution | 📺 |Easy|Math| | 1518 |Water Bottles| Solution | |Easy|Greedy| | 1514 |Path with Maximum Probability| Solution | |Medium|Graph| | 1512 |Number of Good Pairs| Solution | |Easy|Array, HashTable, Math| | 1508 |Range Sum of Sorted Subarray Sums| Solution | |Medium|Array, Sort| | 1507 |Reformat Date| Solution | |Easy|String| | 1502 |Can Make Arithmetic Progression From Sequence| Solution | |Easy|Array, Sort| | 1496 |Path Crossing| Solution | |Easy|String| | 1493 |Longest Subarray of 1's After Deleting One Element| Solution | 📺 |Medium|Array| | 1492 |The kth Factor of n| Solution | |Medium|Math| | 1491 |Average Salary Excluding the Minimum and Maximum Salary| Solution | |Easy|Array, Sort| | 1490 |Clone N-ary Tree| Solution | 📺 |Medium|HashTable, Tree, DFS, BFS| | 1487 |Making File Names Unique| Solution | |Medium|HashTable, String| | 1486 |XOR Operation in an Array| Solution | |Medium|Array, Bit Manipulation| | 1485 |Clone Binary Tree With Random Pointer| Solution | |Medium|HashTable, Tree, DFS, BFS| | 1482 |Minimum Number of Days to Make m Bouquets| Solution | |Medium|Array, Binary Search| | 1481 |Least Number of Unique Integers after K Removals| Solution | |Medium|Array, Sort| | 1480 |Running Sum of 1d Array| Solution, C++ | |Easy|Array| | 1476 |Subrectangle Queries| Solution | |Medium|Array| | 1475 |Final Prices With a Special Discount in a Shop| Solution | |Easy|Array| | 1474 |Delete N Nodes After M Nodes of a Linked List| Solution | |Easy|LinkedList| | 1472 |Design Browser History| Solution | |Medium|Array, Design| | 1471 |The k Strongest Values in an Array| Solution | |Medium|Array, Sort| | 1470 |Shuffle the Array| Solution, C++ | |Easy|Array| | 1469 |Find All The Lonely Nodes| Solution | |Easy|Tree, DFS| | 1466 |Reorder Routes to Make All Paths Lead to the City Zero| Solution | |Medium|Tree, DFS| | 1464 |Maximum Product of Two Elements in an Array| Solution | |Easy|Array| | 1461 |Check If a String Contains All Binary Codes of Size K| Solution | |Medium|String, Bit Manipulation| | 1460 |Make Two Arrays Equal by Reversing Sub-arrays| Solution | |Easy|Array| | 1457 |Pseudo-Palindromic Paths in a Binary Tree| Solution | |Medium|Bit Manipulation, Tree, DFS| | 1456 |Maximum Number of Vowels in a Substring of Given Length| Solution | |Medium|String, Sliding Window| | 1455 |Check If a Word Occurs As a Prefix of Any Word in a Sentence| Solution | |Easy|String| | 1452 |People Whose List of Favorite Companies Is Not a Subset of Another List| Solution | |Medium|String, Sort| | 1451 |Rearrange Words in a Sentence| Solution | |Medium|String, Sort| | 1450 |Number of Students Doing Homework at a Given Time| Solution | |Easy|Array| | 1448 |Count Good Nodes in Binary Tree| Solution | |Medium|Tree, DFS| | 1447 |Simplified Fractions| Solution | |Medium|Math| | 1446 |Consecutive Characters| Solution | |Easy|String| | 1441 |Build an Array With Stack Operations| Solution | |Easy|Stack| | 1439 |Find the Kth Smallest Sum of a Matrix With Sorted Rows| Solution | |Hard|Array, Binary Search, PriorityQueue, Matrix| | 1438 |Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit| Solution | |Medium|Array, Queue, Sliding Window, PriorityQueue, Monotonic Queue| | 1437 |Check If All 1's Are at Least Length K Places Away| Solution | |Medium|Array| | 1436 |Destination City| Solution | |Easy|String| | 1432 |Max Difference You Can Get From Changing an Integer| Solution | |Medium|String| | 1431 |Kids With the Greatest Number of Candies| Solution, C++ | |Easy|Array| | 1429 |First Unique Number| Solution | |Medium|Array, HashTable, Design, Data Streams| | 1428 |Leftmost Column with at Least a One| Solution | |Medium|Array| | 1427 |Perform String Shifts| Solution | |Easy|Array, Math| | 1426 |Counting Elements| Solution | |Easy|Array| | 1423 |Maximum Points You Can Obtain from Cards| Solution | |Medium|Array, DP, Sliding Window| | 1422 |Maximum Score After Splitting a String| Solution | |Easy|String| | 1418 |Display Table of Food Orders in a Restaurant| Solution | |Medium|HashTable| | 1417 |Reformat The String| Solution | |Easy|String| | 1415 |The k-th Lexicographical String of All Happy Strings of Length n| Solution | |Medium|Backtracking| | 1413 |Minimum Value to Get Positive Step by Step Sum| Solution | |Easy|Array| | 1410 |HTML Entity Parser| Solution | |Medium|String, Stack| | 1409 |Queries on a Permutation With Key| Solution | |Medium|Array| | 1408 |String Matching in an Array| Solution | |Easy|String| | 1403 |Minimum Subsequence in Non-Increasing Order| Solution | |Easy|Greedy, Sort| | 1402 |Reducing Dishes| Solution | |Hard|Dynamic Programming| | 1401 |Circle and Rectangle Overlapping| Solution | |Medium|Geometry| | 1400 |Construct K Palindrome Strings| Solution | |Medium|Greedy| | 1399 |Count Largest Group| Solution | |Easy|Array| | 1396 |Design Underground System| Solution | |Medium|Design| | 1395 |Count Number of Teams| Solution | |Medium|Array| | 1394 |Find Lucky Integer in an Array| Solution | |Easy|Array| | 1392 |Longest Happy Prefix| Solution | |Hard|String, Rolling Hash| | 1390 |Four Divisors| Solution | |Medium|Math| | 1389 |Create Target Array in the Given Order| Solution | |Easy|Array| | 1388 |Pizza With 3n Slices| Solution | |Hard|DP| | 1387 |Sort Integers by The Power Value| Solution | |Medium|Sort, Graph| | 1386 |Cinema Seat Allocation| Solution | |Medium|Array, Greedy| | 1385 |Find the Distance Value Between Two Arrays| Solution | |Easy|Array| | 1382 |Balance a Binary Search Tree| Solution | |Medium|Binary Search Tree| | 1381 |Design a Stack With Increment Operation| Solution | |Medium|Stack, Design| | 1380 |Lucky Numbers in a Matrix| Solution | |Easy|Array| | 1379 |Find a Corresponding Node of a Binary Tree in a Clone of That Tree| Solution | |Medium|Tree| | 1377 |Frog Position After T Seconds| Solution | |Hard|DFS, BFS| | 1376 |Time Needed to Inform All Employees| Solution | |Medium|DFS| | 1375 |Bulb Switcher III| Solution | |Medium|Array| | 1374 |Generate a String With Characters That Have Odd Counts| Solution | |Easy|String| | 1373 |Maximum Sum BST in Binary Tree| Solution | |Hard|DP, BST| | 1372 |Longest ZigZag Path in a Binary Tree| Solution | |Hard|DP, Tree| | 1371 |Find the Longest Substring Containing Vowels in Even Counts| Solution | |Medium|String| | 1370 |Increasing Decreasing String| Solution | |Easy|String, Sort| | 1367 |Linked List in Binary Tree| Solution | |Medium|DP, Linked List, Tree| | 1366 |Rank Teams by Votes| Solution | |Medium|Array, Sort| | 1365 |How Many Numbers Are Smaller Than the Current Number| Solution | |Easy|Array, HashTable| | 1362 |Closest Divisors| Solution | |Medium|Math| | 1361 |Validate Binary Tree Nodes| Solution | |Medium|Graph | 1360 |Number of Days Between Two Dates| Solution | |Easy|| | 1358 |Number of Substrings Containing All Three Characters| Solution | |Medium|String| | 1357 |Apply Discount Every n Orders| Solution | |Medium|Design| | 1356 |Sort Integers by The Number of 1 Bits| Solution | |Easy|Sort, Bit Manipulation| | 1354 |Construct Target Array With Multiple Sums| Solution | |Hard|Greedy| | 1353 |Maximum Number of Events That Can Be Attended| Solution | |Medium|Greedy, Sort, Segment Tree| | 1352 |Product of the Last K Numbers| Solution | |Medium|Array, Design| | 1351 |Count Negative Numbers in a Sorted Matrix| Solution | |Easy|Array, Binary Search| | 1349 |Maximum Students Taking Exam| Solution | |Hard|Dynamic Programming| | 1348 |Tweet Counts Per Frequency| Solution | |Medium|Design| | 1347 |Minimum Number of Steps to Make Two Strings Anagram| Solution | |Easy|String| | 1346 |Check If N and Its Double Exist| Solution | |Easy|Array| | 1345 |Jump Game IV| Solution | |Hard|BFS| | 1344 |Angle Between Hands of a Clock| Solution | |Medium|Math| | 1343 |Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold| Solution | |Medium|Array| | 1342 |Number of Steps to Reduce a Number to Zero| Solution | |Easy|Bit Manipulation| | 1341 |The K Weakest Rows in a Matrix| Solution | |Easy|| | 1339 |Maximum Product of Splitted Binary Tree| Solution | |Medium|DP, Tree| | 1338 |Reduce Array Size to The Half| Solution | |Medium|| | 1337 |Remove Palindromic Subsequences| Solution | |Easy|String| | 1333 |Filter Restaurants by Vegan-Friendly, Price and Distance| Solution | |Medium|| | 1332 |Remove Palindromic Subsequences| Solution | |Easy|String| | 1331 |Rank Transform of an Array| Solution | |Easy|| | 1329 |Sort the Matrix Diagonally| Solution | |Medium|| | 1325 |Delete Leaves With a Given Value| Solution | |Medium|Tree| | 1324 |Print Words Vertically| Solution | |Medium|String| | 1323 |Maximum 69 Number| Solution | |Easy|Math| | 1317 |Convert Integer to the Sum of Two No-Zero Integers| Solution | |Easy|| | 1315 |Sum of Nodes with Even-Valued Grandparent| Solution | |Medium|Tree, DFS| | 1314 |Matrix Block Sum| Solution | |Medium|Dynamic Programming| | 1313 |Decompress Run-Length Encoded List| Solution | |Easy|Array| | 1305 |All Elements in Two Binary Search Trees| Solution | |Medium|| | 1304 |Find N Unique Integers Sum up to Zero| Solution | |Easy|| | 1302 |Deepest Leaves Sum| Solution | |Medium|| | 1300 |Sum of Mutated Array Closest to Target| Solution | |Medium|Binary Search, Sorting| | 1299 |Replace Elements with Greatest Element on Right Side| Solution | |Easy|| | 1297 |Maximum Number of Occurrences of a Substring| Solution | |Medium|| | 1296 |Divide Array in Sets of K Consecutive Numbers| Solution | |Medium|| | 1295 |Find Numbers with Even Number of Digits| Java Javascript | 📺 |Easy|| | 1291 |Sequential Digits| Solution | |Medium|| | 1290 |Convert Binary Number in a Linked List to Integer| Solution | |Easy|| | 1289 |Minimum Falling Path Sum II| Solution | |Hard|Dynamic Programming| | 1287 |Element Appearing More Than 25% In Sorted Array| Solution | 📺 |Easy|| | 1286 |Iterator for Combination| Solution | |Medium|Backtracking, Design| | 1283 |Find the Smallest Divisor Given a Threshold| Solution | Medium | | 1282 |Group the People Given the Group Size They Belong To| Solution | 📺 |Medium|| | 1281 |Subtract the Product and Sum of Digits of an Integer| Solution | |Easy|| | 1277 |Count Square Submatrices with All Ones| Solution | |Medium|| | 1275 |Find Winner on a Tic Tac Toe Game| Solution | |Easy|Array| | 1273 |Delete Tree Nodes| Solution | |Medium|Dynamic Programming, DFS | | 1271 |Hexspeak| Solution | |Easy|| | 1268 |Search Suggestions System| Solution | 📺 |Medium|String| | 1267 |Count Servers that Communicate| Solution | |Medium|| | 1266 |Minimum Time Visiting All Points| Solution | |Easy|| | 1265 |Print Immutable Linked List in Reverse| Solution | |Medium|| | 1261 |Find Elements in a Contaminated Binary Tree| Solution || Medium |Tree, HashTable| | 1260 |Shift 2D Grid| Solution | 📺 |Easy|| | 1258 |Synonymous Sentences| Solution || Medium |Backtracking| | 1257 |Smallest Common Region| Solution || Medium |Tree, HashTable, DFS, BFS| | 1252 |Cells with Odd Values in a Matrix| Solution | |Easy|| | 1249 |Minimum Remove to Make Valid Parentheses| Solution | |Medium|String, Stack| | 1243 |Array Transformation| Solution | 📺 |Easy|| | 1237 |Find Positive Integer Solution for a Given Equation| Solution | |Easy|| | 1232 |Check If It Is a Straight Line| Solution | 📺 |Easy|| | 1228 |Missing Number In Arithmetic Progression| Solution | |Easy|| | 1221 |Split a String in Balanced Strings| Solution | |Easy|Greedy| | 1219 |Path with Maximum Gold| Solution | |Medium|Backtracking| | 1217 |Play with Chips| Solution | |Easy|Array, Math, Greedy| | 1214 |Two Sum BSTs| Solution | |Medium| Binary Search Tree| | 1213 |Intersection of Three Sorted Arrays| Solution | 📺 |Easy|| | 1209 |Remove All Adjacent Duplicates in String II| Solution || Medium |Stack| | 1207 |Unique Number of Occurrences| Solution | 📺 |Easy|| | 1200 |Minimum Absolute Difference| Solution | 📺 |Easy|| | 1198 |Find Smallest Common Element in All Rows| Solution | 📺 |Easy|| | 1196 |How Many Apples Can You Put into the Basket| Solution | 📺 |Easy|| | 1190 |Reverse Substrings Between Each Pair of Parentheses| Solution | |Medium|Stack| | 1189 |Maximum Number of Balloons| Solution | 📺 |Easy|| | 1185 |Day of the Week| Solution | |Easy|| | 1184 |Distance Between Bus Stops| Solution | 📺 |Easy|| | 1182 |Shortest Distance to Target Color| Solution || Medium |Binary Search| | 1180 |Count Substrings with Only One Distinct Letter| Solution | |Easy|Math, String| | 1176 |Diet Plan Performance| Solution | |Easy|Array, Sliding Window| | 1175 |Prime Arrangements| Solution | |Easy|Math| | 1171 |Remove Zero Sum Consecutive Nodes from Linked List| Solution | |Medium|LinkedList| | 1165 |Single-Row Keyboard| Solution | |Easy|| | 1161 |Maximum Level Sum of a Binary Tree| Solution | |Medium|Graph| | 1160 |Find Words That Can Be Formed by Characters| Solution | |Easy|| | 1154 |Day of the Year| Solution | |Easy|| | 1152 |Analyze User Website Visit Pattern| Solution | 📺 |Medium|HashTable, Sort, Array| | 1151 |Minimum Swaps to Group All 1's Together| Solution || Medium |Array, Sliding Window| | 1150 |Check If a Number Is Majority Element in a Sorted Array| Solution | 📺 |Easy|| | 1146 |Snapshot Array| Javascript | | Easy || | 1143 |Longest Common Subsequence| Solution | |Medium||String, DP | 1138 |Alphabet Board Path| Solution | 📺 | Medium |HashTable, String| | 1137 |N-th Tribonacci Number| Solution | |Easy|| | 1136 |Parallel Courses| Solution | |Medium|| | 1134 |Armstrong Number| Solution | 📺 |Easy|| | 1133 |Largest Unique Number| Solution | 📺 |Easy|| | 1128 |Number of Equivalent Domino Pairs| Solution | 📺 |Easy|| | 1122 |Relative Sort Array| Solution | |Easy|| | 1170 |Compare Strings by Frequency of the Smallest Character| Solution | |Easy|| | 1119 |Remove Vowels from a String| Solution | 📺 |Easy|| | 1118 |Number of Days in a Month| Solution | |Easy|| | 1114 |Print in Order| Solution | |Easy|| | 1110 |Delete Nodes And Return Forest| Solution | |Medium|Tree, DFS| | 1108 |Defanging an IP Address| Solution | 📺 |Easy|| | 1104 |Path In Zigzag Labelled Binary Tree| Solution | |Medium|Math, Tree| | 1103 |Distribute Candies to People| Solution | |Easy|Math| | 1100 |Find K-Length Substrings With No Repeated Characters| Solution | |Medium|String, Sliding Window| | 1099 |Two Sum Less Than K| Solution | 📺 |Easy|| | 1094 |Car Pooling| Solution | |Medium|Array, Sorting, Heap, Simulation, Prefix Sum| | 1090 |Largest Values From Labels| Solution | 📺 |Medium|HashTable, Greedy| | 1091 |Shortest Path in Binary Matrix| Solution | |Medium|BFS| | 1089 |Duplicate Zeros| Solution | |Easy|| | 1087 |Brace Expansion| Solution | |Medium|Backtracking| | 1086 |High Five| Solution | 📺 |Easy|| | 1085 |Sum of Digits in the Minimum Number| Solution | 📺 |Easy|| | 1079 |Letter Tile Possibilities| Solution | |Medium|| | 1078 |Occurrences After Bigram| Solution | |Easy|| | 1071 |Greatest Common Divisor of Strings| Solution | |Easy|| | 1066 |Campus Bikes II| Solution | |Medium|Backtracking, DP| | 1065 |Index Pairs of a String| Solution | |Medium|| | 1062 |Longest Repeating Substring| Solution | |Medium|String, Binary Search, DP, Rolling Hash, Suffix Array, Hash Function| | 1057 |Campus Bikes| Solution | |Medium||Greedy, Sort | 1056 |Confusing Number| Solution | |Easy|| | 1055 |Fixed Point| Solution | |Easy|| | 1051 |Height Checker| Solution | |Easy|| | 1047 |Remove All Adjacent Duplicates In String| Solution | |Easy|| | 1046 |Last Stone Weight| Solution | 📺 |Easy|| | 1043 |Partition Array for Maximum Sum| Solution | |Medium|DP| | 1038 |Binary Search Tree to Greater Sum Tree| Solution | |Medium|DFS, tree| | 1037 |Valid Boomerang| Solution | |Easy|Math| | 1033 |Moving Stones Until Consecutive| Solution | |Easy|Math| | 1030 |Matrix Cells in Distance Order| Solution | |Easy| | 1029 |Two City Scheduling| Solution | |Easy| | 1026 |Maximum Difference Between Node and Ancestor| Solution | |Medium|Tree, DFS, Binary Tree| | 1025 |Divisor Game| Solution | |Easy|Math, DP, Brainteaser, Game Theory| | 1024 |Video Stitching| Solution | |Medium|Array, DP, Greedy| | 1022 |Sum of Root To Leaf Binary Numbers| Solution | |Easy| | 1021 |Remove Outermost Parentheses| Solution | |Easy| | 1020 |Number of Enclaves| Solution | |Medium|Graph, DFS, BFS, recursion| | 1019 |Next Greater Node In Linked List| Solution | |Medium|Linked List, Stack| | 1018 |Binary Prefix Divisible By 5| Solution | |Easy| | 1014 |Best Sightseeing Pair| Solution | |Medium| | 1013 |Partition Array Into Three Parts With Equal Sum| Solution | |Easy| | 1011 |Capacity To Ship Packages Within D Days| Solution | |Medium|Binary Search| | 1010 |Pairs of Songs With Total Durations Divisible by 60| Solution | |Easy| | 1009 |Complement of Base 10 Integer| Solution | |Easy| | 1008 |Construct Binary Search Tree from Preorder Traversal| Solution | |Medium| Recursion | 1005 |Maximize Sum Of Array After K Negations| Solution | 📺 |Easy| | 1004 |Max Consecutive Ones III| Solution | 📺 |Medium| Two Pointers, Sliding Window | 1003 |Check If Word Is Valid After Substitutions| Solution | |Medium| | 1002 |Find Common Characters| Solution | |Easy| | 999 |Available Captures for Rook| Solution | |Easy| | 991 |Broken Calculator| Solution | |Medium|Math, Greedy | 981 |Time Based Key-Value Store| Solution | 📺 |Medium| | 997 |Find the Town Judge| Solution | |Easy| | 994 |Rotting Oranges| Solution | |Medium| BFS | 993 |Cousins in Binary Tree| Solution | |Easy| Tree, BFS | 989 |Add to Array-Form of Integer| Solution | |Easy| Array | 988 |Smallest String Starting From Leaf| Solution | |Medium| Tree, DFS | 987 |Vertical Order Traversal of a Binary Tree| Solution | |Medium| Recursion | 986 |Interval List Intersections| Solution | |Medium| Two Pointers | 985 |Sum of Even Numbers After Queries| Solution | |Easy| Array | 980 |Unique Paths III| Solution | |Hard| Backtracking, DFS | 979 |Distribute Coins in Binary Tree| Solution | |Medium| Recursion | 977 |Squares of a Sorted Array| Solution | |Easy| Array | 976 |Largest Perimeter Triangle| Solution | |Easy| Math Array | 974 |Subarray Sums Divisible by K| Solution | |Medium| Array| | 973 |K Closest Points to Origin| Solution | |Easy| Math Sort| | 970 |Powerful Integers| Solution | |Easy| Math | 966 |Vowel Spellchecker| Solution | |Medium| Hash Table, String | 965 |Univalued Binary Tree| Solution | |Easy| DFS, recursion| | 961 |N-Repeated Element in Size 2N Array| Solution | |Easy| | 958 |Check Completeness of a Binary Tree| Solution | |Medium|Tree | 957 |Prison Cells After N Days| Solution | 📺 |Medium| | 954 |Array of Doubled Pairs| Solution | 📺 |Medium| | 953 |Verifying an Alien Dictionary| Solution | |Easy| | 951 |Flip Equivalent Binary Trees| Solution | |Medium| Tree, DFS, recursion| | 950 |Reveal Cards In Increasing Order| Solution | |Medium| | 946 |Validate Stack Sequences| Solution | |Medium|Stack | 944 |Delete Columns to Make Sorted| Solution | |Easy| | 942 |DI String Match| Solution | |Easy| | 941 |Valid Mountain Array| Solution | |Easy| | 938 |Range Sum of BST| Solution | |Medium| BST, recursion, DFS | 937 |Reorder Log Files| Solution | |Easy| | 936 |Stamping The Sequence| Solution | |Hard| String, Greedy | 935 |Knight Dialer| Solution | |Medium| | 933 |Number of Recent Calls| Solution | |Easy| | 931 |Minimum Falling Path Sum| Solution | |Medium|Dynamic Programming | 929 |Unique Email Addresses| Solution | |Easy| | 925 |Long Pressed Name| Solution | |Easy| | 923 |3Sum With Multiplicity| Solution | |Medium|Two Pointers | 922 |Sort Array By Parity II| Solution | |Easy| | 921 |Minimum Add to Make Parentheses Valid| Solution | |Medium|Stack, Greedy | 918 |Maximum Sum Circular Subarray| Solution | |Medium|Array, DP, Monotonic Queue | 917 |Reverse Only Letters| Solution | |Easy| | 914 |X of a Kind in a Deck of Cards| Solution | |Easy| | 912 |Sort an Array| Solution | |Easy| | 908 |Smallest Range I| Solution | |Easy| | 901 |Online Stock Span| Solution | |Medium| Stack | 904 |Fruit Into Baskets| Solution | 📺 |Medium| Two Pointers | 900 |RLE Iterator| Solution | |Medium| | 897 |Increasing Order Search Tree| Solution | |Easy| DFS, recursion | 896 |Monotonic Array| Solution | |Easy| | 895 |Maximum Frequency Stack| Solution | HashTable, Stack |Hard| | 893 |Groups of Special-Equivalent Strings| Solution | 📺 |Easy| | 892 |Surface Area of 3D Shapes| Solution | Array, Math, Geometry, Matrix |Easy| | 890 |Find and Replace Pattern| Solution | |Medium| | 888 |Fair Candy Swap| Solution | |Easy| | 885 |Spiral Matrix III| Solution | 📺 |Medium| | 884 |Uncommon Words from Two Sentences| Solution | |Easy| | 883 |Projection Area of 3D Shapes| Solution | |Easy|Math | 881 |Boats to Save People| Solution | |Medium|Two Pointers, Greedy | 880 |Decoded String at Index| Solution | |Medium|Stack | 877 |Stone Game| Solution | |Medium| Math, DP, Minimax | 876 |Middle of the Linked List| Solution | |Easy| | 872 |Leaf-Similar Trees| Solution | |Easy| DFS, recursion | 870 |Advantage Shuffle| Solution | |Medium|Array, Greedy | 868 |Binary Gap| Solution | |Easy| | 867 |Transpose Matrix| Solution | |Easy| | 861 |Score After Flipping Matrix| Solution | |Medium| Greedy | 860 |Lemonade Change| Solution | |Easy| | 859 |Buddy Strings| Solution | |Easy| | 856 |Score of Parentheses| Solution | |Medium| Stack, String | 852 |Peak Index in a Mountain Array| Solution | |Easy| | 849 |Maximize Distance to Closest Person| Solution | |Easy| | 848 |Shifting Letters| Solution | |Medium| Array, String | 844 |Backspace String Compare| Solution | |Easy| | 841 |Keys and Rooms| Solution | |Easy|DFS, Graph | 840 |Magic Squares In Grid| Solution | |Easy| | 838 |Push Dominoes| Solution | 📺 |Medium| Two Pointers, DP | 836 |Rectangle Overlap| Solution | 📺 |Easy| | 832 |Flipping an Image| Solution | |Easy| | 830 |Positions of Large Groups| Solution | |Easy| | 824 |Goat Latin| Solution | |Easy| | 823 |Binary Trees With Factors| Solution | |Medium| | 821 |Shortest Distance to a Character| Solution | |Easy| | 820 |Short Encoding of Words| Solution | |Medium| | 819 |Most Common Word| Solution | |Easy| HashMap | 816 |Ambiguous Coordinates| Solution | |Medium| String | 814 |Binary Tree Pruning| Solution | |Medium| recursion, DFS | 812 |Largest Triangle Area| Solution | |Easy| Array, Math, Geometry | 811 |Subdomain Visit Count| Solution | |Easy| HashMap | 809 |Expressive Words| Solution | |Medium| | 807 |Max Increase to Keep City Skyline| Solution | |Medium| | 806 |Number of Lines To Write String| Solution | |Easy| | 804 |Unique Morse Code Words| Solution | |Easy| | 800 |Similar RGB Color| Solution | |Easy| | 799 |Champagne Tower| Solution | |Medium| | 796 |Rotate String| Solution | |Easy| | 792 |Number of Matching Subsequences| Solution | |Medium|HashTable, String, Trie, Sorting | 791 |Custom Sort String| Solution | |Medium| | 789 |Escape The Ghosts| Solution | |Medium| Math| | 788 |Rotated Digits| Solution | |Easy| | 784 |Letter Case Permutation| Solution | |Easy| | 783 |Minimum Distance Between BST Nodes| Solution | |Easy| | 781 |Rabbits in Forest| Solution | 📺 |Medium| HashTable, Math | 779 |K-th Symbol in Grammar| Solution | |Medium| | 776 |Split BST| Solution | |Medium| Recursion | 775 |Global and Local Inversions| Solution | |Medium| Array, Math | 771 |Jewels and Stones| Solution | |Easy| | 769 |Max Chunks To Make Sorted| Solution | |Medium| Array | 767 |Reorganize String| Solution | |Medium| | 766 |Toeplitz Matrix| Solution | |Easy| | 765 |Couples Holding Hands| Solution | |Hard| | 764 |Largest Plus Sign| Solution | |Medium| DP | 763 |Partition Labels| Solution | |Medium| | 762 |Prime Number of Set Bits in Binary Representation| Solution | |Easy| | 760 |Find Anagram Mappings| Solution | |Easy| | 758 |Bold Words in String| Solution | |Easy| | 757 |Set Intersection Size At Least Two| Solution | |Hard| | 756 |Pyramid Transition Matrix| Solution | |Medium| Backtracking | 755 |Pour Water| Solution || Medium | Array | 754 |Reach a Number| Solution || Medium | Math | 750 |Number Of Corner Rectangles| Solution | |Medium| | 748 |Shortest Completing Word| Solution | |Easy| | 747 |Largest Number Greater Than Twice of Others| Solution | |Easy| | 746 |Min Cost Climbing Stairs| Solution | |Easy| | 744 |Find Smallest Letter Greater Than Target| Solution | | Easy| | 743 |Network Delay Time| Solution || Medium |Graph, Djikstra| | 742 |Closest Leaf in a Binary Tree| Solution | |Medium|Tree | 740 |Delete and Earn| Solution | |Medium| | 739 |Daily Temperatures| Solution | |Medium| | 738 |Monotone Increasing Digits| Solution | |Medium| | 737 |Sentence Similarity II| Solution | |Medium| Union Find | 735 |Asteroid Collision| Solution | |Medium | Stack | 734 |Sentence Similarity| Solution | |Easy | HashTable | 733 |Flood Fill| Solution | | Easy | BFS, DFS | 729 |My Calendar I| Solution || Medium | | 728 |Self Dividing Numbers| Solution | |Easy | | 727 |Minimum Window Subsequence| Solution | |Hard | DP | 725 |Split Linked List in Parts| Solution | |Medium | LinkedList | 724 |Find Pivot Index| Solution | |Easy | Array | 723 |Candy Crush| Solution | |Medium | Array, Two Pointers | 721 |Accounts Merge| Solution | |Medium | DFS, Union Find | 720 |Longest Word in Dictionary| Solution | |Easy | Trie | 719 |Find K-th Smallest Pair Distance| Solution | |Hard | Binary Search | 718 |Maximum Length of Repeated Subarray| Solution | |Medium | DP | 717 |1-bit and 2-bit Characters| Solution | |Easy | | 716 |Max Stack| Solution | |Hard| Design | 714 |Best Time to Buy and Sell Stock with Transaction Fee| Solution | |Medium | DP | 713 |Subarray Product Less Than K| Solution || Medium | | 712 |Minimum ASCII Delete Sum for Two Strings| Solution | |Medium | DP | 709 |To Lower Case| Solution | |Easy| String | 706 |Design HashMap| Solution | |Easy| Design | 705 |Design HashSet| Solution | |Easy| Design | 704 |Binary Search| Solution | |Easy| Binary Search | 703 |Kth Largest Element in a Stream| Solution | |Easy| | 701 |Insert into a Binary Search Tree| Solution | |Medium | DFS, recursion | 700 |Search in a Binary Search Tree| Solution | |Easy| recusion, dfs | 699 |Falling Squares| Solution || Hard | Segment Tree | 698 |Partition to K Equal Sum Subsets| Java, C++ | |Medium | Backtracking + DP | 697 |Degree of an Array| Solution || Easy | | 696 |Count Binary Substrings| Solution | |Easy | | 695 |Max Area of Island| Solution | |Medium | DFS, FBS, Union Find, Matrix | 694 |Number of Distinct Islands| Solution | |Medium | DFS | 693 |Binary Number with Alternating Bits| Solution | |Easy | | 692 |Top K Frequent Words| Solution | | Medium | | 691 |Stickers to Spell Word| Solution | | Hard | DP | 690 |Employee Importance| Solution | |Easy | DFS | 689 |Maximum Sum of 3 Non-Overlapping Subarrays| Solution | |Hard | DP | 688 |Knight Probability in Chessboard| Solution | |Medium | DP | 687 |Longest Univalue Path| Solution | |Easy | DFS | 686 |Repeated String Match| Solution | |Easy | | 685 |Redundant Connection II| Solution | | Hard | Union Find | 684 |Redundant Connection| Solution | |Medium | Union Find | 683 |K Empty Slots| Solution | |Hard | | 682 |Baseball Game| Solution | |Easy | | 681 |Next Closest Time| Solution | |Medium | | 680 |Valid Palindrome II| Solution | |Easy | String | 679 |24 Game| Solution | |Hard | Recursion | 678 |Valid Parenthesis String| Solution | |Medium| Recursion, Greedy | 677 |Map Sum Pairs| Solution | |Medium | HashMap, Trie | 676 |Implement Magic Dictionary| Solution | | Medium | | 675 |Cut Off Trees for Golf Event| Solution | |Hard | BFS | 674 |Longest Continuous Increasing Subsequence| Solution | |Easy | | 673 |Number of Longest Increasing Subsequence| Solution | |Medium | DP | 672 |Bulb Switcher II| Solution | |Medium | Math | 671 |Second Minimum Node In a Binary Tree| Solution | |Easy | Tree, DFS | 670 |Maximum Swap| Solution | |Medium | String | 669 |Trim a Binary Search Tree| Solution | |Easy | Tree, DFS | 668 |Kth Smallest Number in Multiplication Table| Solution | |Hard | Binary Search | 667 |Beautiful Arrangement II| Solution | |Medium | Array | 666 |Path Sum IV| Solution | |Medium | Tree, DFS | 665 |Non-decreasing Array| Solution | |Easy | | 664 |Strange Printer| Solution | |Hard | DP | 663 |Equal Tree Partition| Solution | |Medium | Tree | 662 |Maximum Width of Binary Tree| Solution | |Medium | BFS, DFS | 661 |Image Smoother| Solution | |Easy | Array | 660 |Remove 9| Solution | |Hard | Math | 659 |Split Array into Consecutive Subsequences| Solution | |Medium | HashMap | 658 |Find K Closest Elements| Solution | |Medium | | 657 |Judge Route Circle| Solution | |Easy | | 656 |Coin Path| Solution | |Hard | DP | 655 |Print Binary Tree| Solution | |Medium | Recursion | 654 |Maximum Binary Tree| Solution | |Medium | Tree | 653 |Two Sum IV - Input is a BST| Solution | |Easy | Tree | 652 |Find Duplicate Subtrees| Solution | |Medium | Tree | 651 |4 Keys Keyboard| Solution | |Medium | DP | 650 |2 Keys Keyboard| Solution | |Medium | DP | 649 |Dota2 Senate| Solution | |Medium | Greedy | 648 |Replace Words| Solution | |Medium | Trie | 647 |Palindromic Substrings| Solution | |Medium | DP | 646 |Maximum Length of Pair Chain| Solution | |Medium | DP, Greedy | 645 |Set Mismatch| Solution | |Easy | | 644 |Maximum Average Subarray II| Solution | |Hard | Binary Search | 643 |Maximum Average Subarray I| Solution | | Easy | | 642 |Design Search Autocomplete System| Solution | |Hard | Design | 640 |Solve the Equation| Solution | |Medium | | 639 |Decode Ways II| Solution | |Hard| DP | 638 |Shopping Offers| Solution | |Medium | DP, DFS | 637 |Average of Levels in Binary Tree| Solution | |Easy | | 636 |Exclusive Time of Functions| Solution | |Medium | Stack | 635 |Design Log Storage System| Solution | |Medium | Design | 634 |Find the Derangement of An Array| Solution | |Medium | Math | 633 |Sum of Square Numbers| Solution | |Easy | Binary Search | 632 |Smallest Range| Solution | |Hard| Heap | 631 |Design Excel Sum Formula| Solution | |Hard| Design, Topological Sort | 630 |Course Schedule III| Solution | |Hard| Heap, Greedy | 629 |K Inverse Pairs Array| Solution | |Hard| DP | 628 |Maximum Product of Three Numbers| Solution | |Easy | | 625 |Minimum Factorization| Solution | |Medium | | 624 |Maximum Distance in Arrays| Solution | |Easy | Sort, Array | 623 |Add One Row to Tree| Solution | |Medium | Tree | 622 |Design Circular Queue| Solution | |Medium | Design, Queue | 621 |Task Scheduler| Solution | |Medium | Greedy, Queue | 617 |Merge Two Binary Trees| Solution | |Easy | Tree, Recursion | 616 |Add Bold Tag in String| Solution | | Medium | String | 611 |Valid Triangle Number| Solution | |Medium | Binary Search | 609 |Find Duplicate File in System| Solution | |Medium | HashMap | 606 |Construct String from Binary Tree| Solution | |Easy | Tree, Recursion | 605 |Can Place Flowers| Solution | |Easy | Array | 604 |Design Compressed String Iterator| Solution | |Easy |Design, String | 600 |Non-negative Integers without Consecutive Ones| Solution | |Hard | Bit Manipulation, DP | 599 |Minimum Index Sum of Two Lists| Solution | |Easy | HashMap | 598 |Range Addition II| Solution | |Easy | | 594 |Longest Harmonious Subsequence| Solution | |Easy | Array, HashMap | 593 |Valid Square| Java, Javascript | |Medium | Math | 592 |Fraction Addition and Subtraction| Solution | |Medium | Math | 591 |Tag Validator| Solution | |Hard | Stack, String | 590 |N-ary Tree Postorder Traversal| Solution | |Easy| DFS, recursion | 589 |N-ary Tree Preorder Traversal| Solution | |Easy | DFS, recursion | 588 |Design In-Memory File System| Solution | |Hard | Trie, Design | 587 |Erect the Fence| Solution | |Hard | Geometry | 583 |Delete Operation for Two Strings| Solution | |Medium | DP | 582 |Kill Process| Solution | |Medium | Stack | 581 |Shortest Unsorted Continuous Subarray| Solution | |Easy | Array, Sort | 576 |Out of Boundary Paths| Solution | |Hard | DP, DFS | 575 |Distribute Candies| Solution | |Easy | Array | 573 |Squirrel Simulation| Solution | |Medium | Math | 572 |Subtree of Another Tree| Solution | |Easy | Tree | 568 |Maximum Vacation Days| Solution | |Hard | DP | 567 |Permutation in String| Solution | | Medium | Sliding Windows, Two Pointers | 566 |Reshape the Matrix| Solution | |Easy | | 565 |Array Nesting| Solution | | Medium | | 563 |Binary Tree Tilt| Solution | |Easy | Tree Recursion | 562 |Longest Line of Consecutive One in Matrix| Solution | |Medium | Matrix DP | 561 |Array Partition I| Solution | |Easy | Array | 560 |Subarray Sum Equals K| Solution || Medium | Array, HashMap | 559 |Maximum Depth of N-ary Tree| Solution | |Easy | DFS, recursion | 557 |Reverse Words in a String III| Solution | |Easy | String | 556 |Next Greater Element III| Solution | |Medium | String | 555 |Split Concatenated Strings| Solution | |Medium | String | 554 |Brick Wall| Solution | |Medium | HashMap | 553 |Optimal Division| Solution | |Medium | String, Math | 552 |Student Attendance Record II| Solution | |Hard| DP | 551 |Student Attendance Record I| Solution | |Easy| String | 549 |Binary Tree Longest Consecutive Sequence II| Solution | |Medium | Tree | 548 |Split Array with Equal Sum| Solution | |Medium | Array | 547 |Friend Circles| Solution | |Medium | Union Find | 546 |Remove Boxes| Solution | |Hard| DFS, DP | 545 |Boundary of Binary Tree| Solution | |Medium | Recursion | 544 |Output Contest Matches| Solution | |Medium | Recursion | 543 |Diameter of Binary Tree| Solution | | Easy | Tree/DFS/Recursion | 542 |01 Matrix| Solution | |Medium | BFS | 541 |Reverse String II| Solution | |Easy | String | 540 |Single Element in a Sorted Array| Solution | |Medium |Array, Binary Search | 539 |Minimum Time Difference| Solution | | Medium | String | 538 |Convert BST to Greater Tree| Solution | |Easy | Tree | 537 |Complex Number Multiplication| Solution | |Medium | Math, String | 536 |Construct Binary Tree from String| Solution | | Medium | Recursion, Stack | 535 |Encode and Decode TinyURL| Solution | |Medium | Design | 533 |Lonely Pixel II| Solution | | Medium | HashMap | 532 |K-diff Pairs in an Array| Solution | |Easy | HashMap | 531 |Lonely Pixel I| Solution | |Medium | | 530 |Minimum Absolute Difference in BST| Solution | |Easy| DFS | 529 |Minesweeper| Solution | |Medium | BFS | 528 |Random Pick with Weight| Solution | |Medium | Math, Binary Search, Prefix Sum, Randomized | 527 |Word Abbreviation| Solution | |Hard | | 526 |Beautiful Arrangement| Solution | |Medium | Backtracking | 525 |Contiguous Array| Solution | |Medium | HashMap | 524 |Longest Word in Dictionary through Deleting| Solution | |Medium | Sort | 523 |Continuous Subarray Sum| Solution | |Medium| DP | 522 |Longest Uncommon Subsequence II| Solution | | Medium| | 521 |Longest Uncommon Subsequence I| Solution | | Easy| | 520 |Detect Capital| Solution | |Easy| | 518 |Coin Change 2| Solution | |Medium| Array, DP | 517 |Super Washing Machines| Solution | |Hard| DP | 516 |Longest Palindromic Subsequence| Solution | |Medium| DP | 515 |Find Largest Value in Each Tree Row| Solution | |Medium| BFS | 514 |Freedom Trail| Solution | |Hard | DP | 513 |Find Bottom Left Tree Value| Solution || Medium | BFS | 509 |Fibonacci Number| Solution | 📺 |Easy| Array | 508 |Most Frequent Subtree Sum| Solution || Medium | DFS, Tree | 507 |Perfect Number| Solution | |Easy| Math | 506 |Relative Ranks| Solution | |Easy| | 505 |The Maze II| Solution | |Medium| BFS | 504 |Base 7| Solution | |Easy| | 503 |Next Greater Element II| Solution | |Medium| Stack | 502 |IPO| Solution | |Hard| Heap, Greedy | 501 |Find Mode in Binary Tree| Solution | |Easy| Binary Tree | 500 |Keyboard Row| Solution | |Easy| | 499 |The Maze III| Solution | |Hard| BFS | 496 |Next Greater Element I| Solution | |Easy| | 498 |Diagonal Traverse| Solution | |Medium| | 495 |Teemo Attacking| Solution | |Medium| Array | 494 |Target Sum| Solution | |Medium| | 493 |Reverse Pairs| Solution | |Hard| Recursion | 492 |Construct the Rectangle| Solution | |Easy| Array | 491 |Increasing Subsequences| Solution | |Medium| Backtracking, DFS | 490 |The Maze| Solution | |Medium| BFS | 488 |Zuma Game| Solution | |Hard | DFS, Backtracking | 487 |Max Consecutive Ones II| Solution | 📺 |Medium| Array, Sliding Window | 486 |Predict the Winner| Solution | | Medium | DP | 485 |Max Consecutive Ones| Java Javascript | 📺 |Easy| Array | 484 |Find Permutation| Solution | |Medium | Array, String, Greedy | 483 |Smallest Good Base| Solution | |Hard | Binary Search, Math | 482 |License Key Formatting| Solution | |Medium| | 481 |Magical String| Solution || Medium | | 480 |Sliding Window Median| Solution | |Hard| Heap | 479 |Largest Palindrome Product| Solution | |Easy| | 477 |Total Hamming Distance| Solution | |Medium| Bit Manipulation | 478 |Generate Random Point in a Circle| Solution | | Medium| Math, Random, Rejection Sampling | 476 |Number Complement| Solution | | Easy| Bit Manipulation | 475 |Heaters| Solution | |Easy | Array Binary Search | 474 |Ones and Zeroes| Solution | |Medium| DP | 473 |Matchsticks to Square| Solution | |Medium| Backtracking, DFS | 472 |Concatenated Words| Solution | |Hard| Trie, DP, DFS | 471 |Encode String with Shortest Length| Solution | |Hard| DP | 469 |Convex Polygon| Solution | |Medium| Math | 468 |Validate IP Address| Solution | |Medium | String | 467 |Unique Substrings in Wraparound String| Solution || Medium | DP | 466 |Count The Repetitions| Solution | |Hard| DP | 465 |Optimal Account Balancing| Solution | |Hard| DP | 464 |Can I Win| Solution | |Medium| DP | 463 |Island Perimeter| Solution | |Easy| | 462 |Minimum Moves to Equal Array Elements II| Solution || Medium | | 461 |Hamming Distance| Solution, C++ | |Easy| | 460 |LFU Cache| Solution | | Hard| Design, LinkedHashMap, HashMap | 459 |Repeated Substring Pattern| Solution | |Easy| String, KMP | 458 |Poor Pigs| Solution | |Easy| Math | 457 |Circular Array Loop| Solution | |Medium | | 456 |132 Pattern| Solution | |Medium| Stack | 455 |Assign Cookies| Solution | |Easy| | 454 |4Sum II| Solution | |Medium| HashMap | 453 |Minimum Moves to Equal Array Elements| Solution | |Easy| | 452 |Minimum Number of Arrows to Burst Balloons| Solution | |Medium| Array, Greedy | 451 |Sort Characters By Frequency| Solution | |Medium| HashMap | 450 |Delete Node in a BST| Solution | |Medium| Tree, Recursion | 449 |Serialize and Deserialize BST| Solution | |Medium| BFS | 448 |Find All Numbers Disappeared in an Array| Solution | |Easy| Array, HashMap | 447 |Number of Boomerangs| Solution | |Easy| HashMap | 446 |Arithmetic Slices II - Subsequence| Solution | |Hard| DP | 445 |Add Two Numbers II| Solution | |Medium| Stack, LinkedList | 444 |Sequence Reconstruction| Solution | |Medium| Topological Sort, Graph | 443 |String Compression| Solution | |Easy | | 442 |Find All Duplicates in an Array| Solution | |Medium| Array | 441 |Arranging Coins| Solution | |Easy| | 440 |K-th Smallest in Lexicographical Order| Solution | |Hard| | 439 |Ternary Expression Parser| Solution | |Medium| Stack | 438 |Find All Anagrams in a String| Solution | |Easy| Sliding Window | 437 |Path Sum III| Solution | |Easy| DFS, recursion | 436 |Find Right Interval| Solution | |Medium| Binary Search | 435 |Non-overlapping Intervals| Solution | |Medium| Greedy | 434 |Number of Segments in a String| Solution | |Easy| | 432 |All O`one Data Structure| Solution | |Hard| Design | 430 |Flatten a Multilevel Doubly Linked List| Solution | |Medium|LinkedList, DFS, Doubly-Linked List | 429 |N-ary Tree Level Order Traversal| Solution | |Easy| BFS, Tree | 425 |Word Squares| Solution | |Hard| Trie, Backtracking, Recursion | 424 |Longest Repeating Character Replacement| Solution | | Medium| Sliding Window | 423 |Reconstruct Original Digits from English| Solution | | Medium| Math | 422 |Valid Word Square| Solution | |Easy| | 421 |Maximum XOR of Two Numbers in an Array| Solution | |Medium | Bit Manipulation, Trie | 420 |Strong Password Checker| Solution | | Hard| | 419 |Battleships in a Board| Solution | |Medium| DFS | 418 |Sentence Screen Fitting| Solution | |Medium| | 417 |Pacific Atlantic Water Flow| Solution | |Medium| DFS | 416 |Partition Equal Subset Sum| Java, C++ | |Medium | DP | 415 |Add Strings| Solution | |Easy| | 414 |Third Maximum Number| Solution | |Easy| | 413 |Arithmetic Slices| Solution | |Medium| DP | 412 |Fizz Buzz| Solution | |Easy| | 411 |Minimum Unique Word Abbreviation| Solution | |Hard| NP-Hard, Backtracking, Trie, Recursion | 410 |Split Array Largest Sum| Solution | |Hard| Binary Search, DP | 409 |Longest Palindrome| Solution | |Easy| | 408 |Valid Word Abbreviation| Solution | |Easy| | 407 |Trapping Rain Water II| Solution | |Hard| Heap | 406 |Queue Reconstruction by Height| Solution | |Medium| LinkedList, PriorityQueue | 405 |Convert a Number to Hexadecimal| Solution | |Easy| | 404 |Sum of Left Leaves| Solution | |Easy| | 403 |Frog Jump| Solution | |Hard| DP | 402 |Remove K Digits| Solution | |Medium| Greedy, Stack | 401 |Binary Watch| Solution | |Easy| | 400 |Nth Digit| Solution | |Easy| | 399 |Evaluate Division| Solution | |Medium| Graph, DFS, Backtracking | 398 |Random Pick Index| Solution | |Medium| Reservoir Sampling | 397 |Integer Replacement| Solution | |Easy| BFS | 396 |Rotate Function| Solution | |Easy| | 395 |Longest Substring with At Least K Repeating Characters| Solution | |Medium| Recursion | 394 |Decode String| Solution | |Medium| Stack Depth-first-search | 393 |UTF-8 Validation| Solution | |Medium| Bit Manipulation | 392 |Is Subsequence| Solution | |Medium| Array, String | 391 |Perfect Rectangle| Solution | |Hard| | 390 |Elimination Game| Solution | |Medium| | 389 |Find the Difference| Solution | || Easy| | 388 |Longest Absolute File Path| Solution | |Medium| Stack | 387 |First Unique Character in a String| Solution | |Easy| HashMap | 386 |Lexicographical Numbers| Solution | |Medium| | 385 |Mini Parser| Solution | |Medium| Stack | 384 |Shuffle an Array| Solution | |Medium| | 383 |Ransom Note| Solution | |Easy | String | 382 |Linked List Random Node| Solution | |Medium| Reservoir Sampling | 381 |Insert Delete GetRandom O(1) - Duplicates allowed| Solution || Hard | | 380 |Insert Delete GetRandom O(1)| Solution | |Medium| Design, HashMap | 379 |Design Phone Directory| Solution | |Medium| | 378 |Kth Smallest Element in a Sorted Matrix| Solution | |Medium| Binary Search | 377 |Combination Sum IV| Solution | |Medium| DP | 376 |Wiggle Subsequence| Solution | |Medium| DP, Greedy | 375 |Guess Number Higher or Lower II| Solution | |Medium| DP | 374 |Guess Number Higher or Lower| Solution | |Easy| Binary Search | 373 |Find K Pairs with Smallest Sums| Solution | |Medium| Heap | 372 |Super Pow| Solution | |Medium| Math | 371 |Sum of Two Integers| Solution | |Easy| | 370 |Range Addition| Solution | |Medium|Array | 369 |Plus One Linked List| Solution | |Medium| Linked List | 368 |Largest Divisible Subset| Solution | | Medium| DP | 367 |Valid Perfect Square| Solution | |Medium| | 366 |Find Leaves of Binary Tree| Solution | |Medium| DFS | 365 |Water and Jug Problem| Solution | |Medium| Math | 364 |Nested List Weight Sum II| Solution | |Medium| DFS | 363 |Max Sum of Rectangle No Larger Than K| Solution | |Hard| DP | 362 |Design Hit Counter| Solution | |Medium| Design | 361 |Bomb Enemy| Solution | |Medium| | 360 |Sort Transformed Array| Solution | |Medium| Two Pointers, Math | 359 |Logger Rate Limiter| Solution | |Easy| HashMap | 358 |Rearrange String k Distance Apart| Solution | |Hard| HashMap, Heap, Greedy | 357 |Count Numbers with Unique Digits| Solution | |Medium| DP, Math | 356 |Line Reflection| Solution | |Medium| HashSet | 355 |Design Twitter| Solution | |Medium| Design, HashMap, Heap | 354 |Russian Doll Envelopes| Solution | |Hard| DP, Binary Search | 353 |Design Snake Game| Solution | |Medium| | 352 |Data Stream as Disjoint Intervals| Solution | |Hard| TreeMap | 351 |Android Unlock Patterns| Solution | |Medium| | 350 |Intersection of Two Arrays II| Solution | 📺 |Easy| HashMap, Binary Search | 349 |Intersection of Two Arrays| Solution | 📺 |Easy| Two Pointers, Binary Search | 348 |Design Tic-Tac-Toe| Solution | |Medium| Design | 347 |Top K Frequent Elements| Solution | |Medium| HashTable, Heap, Bucket Sort | 346 |Moving Average from Data Stream| Solution | |Easy| Queue | 345 |Reverse Vowels of a String| Solution | |Easy | String | 344 |Reverse String| Solution | 📺 |Easy | String | 343 |Integer Break| Solution | |Medium| Math | 342 |Power of Four| Solution | |Easy| Math | 341 |Flatten Nested List Iterator| Solution | |Medium| Stack | 340 |Longest Substring with At Most K Distinct Characters| Solution | |Hard| Sliding Window | 339 |Nested List Weight Sum| Solution | |Easy| DFS | 338 |Counting Bits| Solution | |Medium| | 337 |House Robber III| Solution | |Medium | DP | 336 |Palindrome Pairs| Solution | |Hard| | 335 |Self Crossing| Solution | |Hard| Math | 334 |Increasing Triplet Subsequence| Solution | |Medium| | 333 |Largest BST Subtree| Solution | |Medium| Tree | 332 |Reconstruct Itinerary| Solution | |Medium| Graph, DFS | 331 |Verify Preorder Serialization of a Binary Tree| Solution | |Medium| Stack | 330 |Patching Array| Solution | |Hard| Greedy | 329 |Longest Increasing Path in a Matrix| Solution | |Hard| DFS, DP | 328 |Odd Even Linked List| Solution | |Medium| Linked List | 327 |Count of Range Sum| Solution | |Hard| BST, Divide and Conquer | 326 |Power of Three| Solution | |Easy| Math | 325 |Maximum Size Subarray Sum Equals k| Solution | |Medium| HashTable | 324 |Wiggle Sort II| Solution | |Medium| Sort | 323 |Number of Connected Components in an Undirected Graph| Solution | | Medium| | 322 |Coin Change| Solution | |Medium| DP | 321 |Create Maximum Number| Solution | |Hard | 320 |Generalized Abbreviation| Solution | |Medium| Backtracking, Bit Manipulation | 319 |Bulb Switcher| Solution | |Medium| Brainteaser | 318 |Maximum Product of Word Lengths| Solution | |Medium| | 317 |Shortest Distance from All Buildings| Solution | |Hard| | 316 |Remove Duplicate Letters| Solution | |Hard| Stack, Recursion, Greedy | 315 |Count of Smaller Numbers After Self| Solution | |Hard| Tree | 314 |Binary Tree Vertical Order Traversal| Solution | |Medium| HashMap, BFS | 313 |Super Ugly Number| Solution | |Medium| | 312 |Burst Balloons| Solution | |Hard| DP | 311 |Sparse Matrix Multiplication| Solution | |Medium| | 310 |Minimum Height Trees| Solution | |Medium| | 309 |Best Time to Buy and Sell Stock with Cooldown| Solution | |Medium| DP | 308 |Range Sum Query 2D - Mutable| Solution | |Hard| Tree | 307 |Range Sum Query - Mutable| Solution | |Medium| Tree | 306 |Additive Number| Solution | |Medium| | 305 |Number of Islands II| Solution | | Hard| Union Find | 304 |Range Sum Query 2D - Immutable| Solution | |Medium| | 303 |Range Sum Query - Immutable| Solution | |Easy| | 302 |Smallest Rectangle Enclosing Black Pixels| Solution | |Hard| DFS, BFS | 301 |Remove Invalid Parentheses| Solution | |Hard| BFS | 300 |Longest Increasing Subsequence| Solution | |Medium| DP | 299 |Bulls and Cows| Solution | |Easy| | 298 |Binary Tree Longest Consecutive Sequence| Solution | |Medium | Tree | 297 |Serialize and Deserialize Binary Tree| Solution | |Hard| BFS | 296 |Best Meeting Point| Solution | |Hard| | 295 |Find Median from Data Stream| Solution | |Hard| Heap | 294 |Flip Game II| Solution | |Medium| Backtracking | 293 |Flip Game| Solution | |Easy| | 292 |Nim Game| Solution | | Easy| | 291 |Word Pattern II| Solution | |Hard| Recursion, Backtracking | 290 |Word Pattern| Solution | |Easy| HashMap | 289 |Game of Life| Solution | 📺 |Medium| | 288 |Unique Word Abbreviation| Solution | |Easy| | 287 |Find the Duplicate Number| Solution | |Medium| | 286 |Walls and Gates| Solution | |Medium| BFS | 285 |Inorder Successor In BST| Solution | |Medium| Tree | 284 |Peeking Iterator| Solution | |Medium| Design | 283 |Move Zeroes| Solution | 📺 |Easy| | 282 |Expression Add Operators| Solution | |Hard| | 281 |Zigzag Iterator| Solution | |Medium| | 280 |Wiggle Sort| Solution | |Medium| | 279 |Perfect Squares| Solution | |Medium| | 278 |First Bad Version| Solution | 📺 |Easy| Binary Search | 277 |Find the Celebrity| Solution | |Medium| | 276 |Paint Fence| Solution | |Easy| DP | 275 |H-Index II| Solution | |Medium| Binary Search | 274 |H-Index| Solution | |Medium| | 273 |Integer to English Words| Solution | |Hard| Math, String | 272 |Closest Binary Search Tree Value II| Solution | |Hard| Stack | 271 |Encode and Decode Strings| Solution | | |Medium| | 270 |Closest Binary Search Tree Value| Solution | | |Easy| DFS | 269 |Alien Dictionary| Solution | | |Hard| Topological Sort | 268 |Missing Number| Solution | | |Easy| Bit Manipulation | 267 |Palindrome Permutation II| Solution | |Medium| | 266 |Palindrome Permutation| Solution | |Easy| | 265 |Paint House II| Solution | |Hard| DP | 264 |Ugly Number II| Solution | |Medium| DP | 263 |Ugly Number| Solution | |Easy| | 261 |Graph Valid Tree| Solution | |Medium| | 260 |Single Number III| Solution | |Medium| | 259 |3Sum Smaller| Solution | |Medium| | 258 |Add Digits| Solution | |Easy| | 257 |Binary Tree Paths| Solution | ||DFS/Recursion | 256 |Paint House| Solution | |Medium| DP | 255 |Verify Preorder Sequence in Binary Search Tree| Solution | |Medium| Tree | 254 |Factor Combinations| Solution | |Medium| Backtracking | 253 |Meeting Rooms II| Solution | |Medium| Heap | 252 |Meeting Rooms| Solution | | Easy | 251 |Flatten 2D Vector| Solution | |Medium| | 250 |Count Univalue Subtrees| Solution | |Medium| DFS | 249 |Group Shifted Strings| Solution | || | 248 |Strobogrammatic Number III| Solution | |Hard | Recursion, DFS | 247 |Strobogrammatic Number II| Solution | |Medium | Recursion | 246 |Strobogrammatic Number| Solution | |Easy | 245 |Shortest Word Distance III| Solution | |Medium | | 244 |Shortest Word Distance II| Solution | |Medium | HashMap | 243 |Shortest Word Distance| Solution | |Easy | 242 |Valid Anagram| Solution | |Easy | 241 |Different Ways to Add Parentheses| Solution | |Medium | Divide and Conquer | 240 |Search a 2D Matrix II| Solution | |Medium| Binary Search | 239 |Sliding Window Maximum| Solution | |Hard| Heap | 238 |Product of Array Except Self| Solution | |Medium| Array | 237 |Delete Node in a Linked List| Solution | 📺 |Easy| LinkedList | 236 |Lowest Common Ancestor of a Binary Tree| Solution | |Medium| DFS | 235 |Lowest Common Ancestor of a Binary Search Tree| Solution | |Easy| DFS | 234 |Palindrome Linked List| Solution | 📺 |Easy| Linked List | 233 |Number of Digit One| Solution | |Hard| Math | 232 |Implement Queue using Stacks| Solution | |Medium| Stack, Design | 231 |Power of Two| Solution | |Easy| | 230 |Kth Smallest Element in a BST| Solution | |Medium| Tree | 229 |Majority Element II| Solution | |Medium| | 228 |Summary Ranges| Solution | |Medium| Array | 227 |Basic Calculator II| Solution | |Medium| String | 226 |Invert Binary Tree| Solution | |Easy| DFS, recursion | 225 |Implement Stack using Queues| Solution | |Easy| Stack, Queue | 224 |Basic Calculator| Solution | |Hard| | 223 |Rectangle Area| Solution | | Easy| | 222 |Count Complete Tree Nodes| Solution | |Medium| Recursion | 221 |Maximal Square| Solution | |Medium| Recursion | 220 |Contains Duplicate III| Solution | 📺 |Medium| TreeSet | 219 |Contains Duplicate II| Solution | 📺 |Easy| HashMap | 218 |The Skyline Problem| Solution | |Hard| TreeMap, Design | 217 |Contains Duplicate| Solution | 📺 |Easy| HashSet | 216 |Combination Sum III| Solution | |Medium| Backtracking | 215 |Kth Largest Element in an Array| Solution | |Medium| Heap | 214 |Shortest Palindrome| Solution | |Hard | KMP | 213 |House Robber II| Solution | |Medium | DP | 212 |Word Search II| Solution | |Hard | Trie | 211 |Add and Search Word - Data structure design| Solution | |Medium| Trie | 210 |Course Schedule II| Solution | |Medium| | 209 |Minimum Size Subarray Sum| Solution | |Medium| | 208 |Implement Trie| Solution | 📺 |Medium| Trie | 207 |Course Schedule| Solution | |Medium| | 206 |Reverse Linked List| Solution | 📺 |Easy | Linked List | 205 |Isomorphic Strings| Solution | |Easy | 204 |Count Primes| Solution | |Easy | The Sieve of Eratosthenes | 203 |Remove Linked List Elements| Solution | |Easy | 202 |Happy Number| Solution | |Easy | 201 |Bitwise AND of Numbers Range| Solution | |Medium | Bit Manipulation | 200 |Number of Islands| Solution | |Medium| Union Find, DFS | 199 |Binary Tree Right Side View| Solution | |Medium | BFS | 198 |House Robber| Solution | |Easy | DP | 191 |Number of 1 Bits| Solution | |Easy | Bit Manipulation | 190 |Reverse Bits| Solution | |Easy | Bit Manipulation | 189 |Rotate Array| Solution | 📺 | Easy | 188 |Best Time to Buy and Sell Stock IV| Solution | |Hard | DP | 187 |Repeated DNA Sequences| Solution | | Medium | 186 |Reverse Words in a String II| Solution | |Medium | 179 |Largest Number| Solution | |Medium| | 174 |Dungeon Game| Solution | |Hard| DP | 173 |Binary Search Tree Iterator| Solution | |Medium| Stack, Design | 172 |Factorial Trailing Zeroes| Solution | |Easy | 171 |Excel Sheet Column Number| Solution | |Easy | 170 |Two Sum III - Data structure design| Solution | |Easy | 169 |Majority Element| Solution | 📺 |Easy| | 168 |Excel Sheet Column Title| Solution | |Easy| | 167 |Two Sum II - Input array is sorted| Java, Javascript | |Easy| Binary Search | 166 |Fraction to Recurring Decimal| Solution | |Medium| HashMap | 165 |Compare Version Numbers| Solution | |Easy| | 164 |Maximum Gap| Solution | |Hard| | 163 |Missing Ranges| Solution | || | 162 |Find Peak Element| Solution | |Binary Search| | 161 |One Edit Distance| Solution | || | 160 |Intersection of Two Linked Lists| Solution | |Easy| Linked List | 159 |Longest Substring with At Most Two Distinct Characters| Solution | | Hard| String, Sliding Window | 158 |Read N Characters Given Read4 II - Call multiple times| Solution | |Hard| | 157 |Read N Characters Given Read4| Solution | |Easy| | 156 |Binary Tree Upside Down| Solution | |Medium| Tree, Recursion | 155 |Min Stack| Solution | |Easy| Stack | 154 |Find Minimum in Rotated Sorted Array II| Solution | |Hard| Array, Binary Search | 153 |Find Minimum in Rotated Sorted Array| Solution | |Medium| Array, Binary Search | 152 |Maximum Product Subarray| Solution | |Medium| Array | 151 |Reverse Words in a String| Solution | | Medium| String | 150 |Evaluate Reverse Polish Notation| Solution | |Medium | 149 |Max Points on a Line| Solution | |Hard| | 148 |Sort List| Solution || Medium | Linked List, Sorting | 147 |Insertion Sort List| Solution || Medium | Linked List | 146 |LRU Cache| Solution | |Hard| Doubly Linked List, LinkedHashMap | 145 |Binary Tree Postorder Traversal| Solution | 📺 |Easy| Binary Tree | 144 |Binary Tree Preorder Traversal| Solution | 📺 and 📺 |Medium| Binary Tree | 143 |Reorder List| Solution | |Medium| | 142 |Linked List Cycle II| Solution | |Medium| Linked List | 141 |Linked List Cycle| Solution | 📺 |Easy| Linked List | 140 |Word Break II| Solution | |Hard| Backtracking/DFS | 139 |Word Break| Solution | 📺 |Medium| DP, Pruning | 138 |Copy List with Random Pointer| Solution | |Medium| LinkedList, HashMap | 137 |Single Number II| Solution | |Medium| Bit Manipulation | 136 |Single Number| Solution | 📺 |Easy | Bit Manipulation | 135 |Candy| Solution | |Hard| Greedy | 134 |Gas Station| Solution | |Medium| Greedy | 133 |Clone Graph| Solution | |Medium| HashMap, BFS, Graph | 132 |Palindrome Partitioning II| Solution | |Hard| | 131 |Palindrome Partitioning| Solution | |Medium| | 130 |Surrounded Regions| Solution | |Medium| | 129 |Sum Root to Leaf Numbers| Solution | |Medium| DFS | 128 |Longest Consecutive Sequence| Solution | |Hard| Union Find | 127 |Word Ladder| Solution | |Hard| BFS | 126 |Word Ladder II| Solution | |Hard| BFS | 125 |Valid Palindrome| Solution | |Easy| Two Pointers | 124 |Binary Tree Maximum Path Sum| Solution | |Hard | Tree, DFS | 123 |Best Time to Buy and Sell Stock III| Solution | |Hard | DP | 122 |Best Time to Buy and Sell Stock II| Solution | |Easy | Greedy | 121 |Best Time to Buy and Sell Stock| Solution | |Easy| | 120 |Triangle| Solution | |Medium| DP | 119 |Pascal's Triangle II| Solution | 📺 |Easy| | 118 |Pascal's Triangle| Solution | 📺 |Easy| | 117 |Populating Next Right Pointers in Each Node II| Solution | |Medium| BFS | 116 |Populating Next Right Pointers in Each Node| Solution | |Medium| BFS | 115 |Distinct Subsequences| Solution | |Hard| DP | 114 |Flatten Binary Tree to Linked List| Solution | |Medium| Tree | 113 |Path Sum II| Solution | |Medium| DFS, Backtracking | 112 |Path Sum| Solution | |Easy| DFS | 111 |Minimum Depth of Binary Tree| Solution | |Easy| BFS, DFS | 110 |Balanced Binary Tree| Solution | |Easy| DFS | 109 |Convert Sorted List to Binary Search Tree| Solution | |Medium | DFS, Recursion | 108 |Convert Sorted Array to Binary Search Tree| Solution | 📺 |Easy | Tree | 107 |Binary Tree Level Order Traversal II| Solution | |Easy| BFS | 106 |Construct Binary Tree from Inorder and Postorder Traversal| Solution | |Medium| Recursion, Tree | 105 |Construct Binary Tree from Preorder and Inorder Traversal| Solution | |Medium| Recursion, Tree | 104 |Maximum Depth of Binary Tree| Solution | 📺 |Easy| DFS | 103 |Binary Tree Zigzag Level Order Traversal| Solution | |Medium| BFS,DFS | 102 |Binary Tree Level Order Traversal| Solution | 📺 |Medium| BFS | 101 |Symmetric Tree| Solution | 📺 |Easy| DFS | 100 |Same Tree| Solution | 📺 |Easy| DFS | 99 |Recover Binary Search Tree| Solution | |Hard | | 98 |Validate Binary Search Tree| Solution | 📺 |Medium | DFS/Recursion | 97 |Interleaving String| Solution | |Hard| DP | 96 |Unique Binary Search Trees| Solution | |Medium | Recursion, DP | 95 |Unique Binary Search Trees II| Solution | |Medium | Recursion | 94 |Binary Tree Inorder Traversal| Solution | 📺 📺 |Medium| Binary Tree | 93 |Restore IP Addresses| Solution | |Medium | Backtracking | 92 |Reverse Linked List II| Solution | |Medium | 91 |Decode Ways| Solution | |Medium| DP | 90 |Subsets II| Solution || Medium |Backtracking | 89 |Gray Code| Solution || Medium |Bit Manipulation | 88 |Merge Sorted Array| Solution || Easy | | 87 |Scramble String| Solution || Hard | Recursion | 86 |Partition List| Solution || Medium | Linked List | 85 |Maximal Rectangle| Solution || Hard |DP | 84 |Largest Rectangle in Histogram| Solution || Hard |Array, Stack | 83 |Remove Duplicates from Sorted List| Solution || Easy | Linked List | 82 |Remove Duplicates from Sorted List II| Solution || Medium | Linked List | 81 |Search in Rotated Sorted Array II| Solution || Medium |Binary Search | 80 |Remove Duplicates from Sorted Array II| Solution || Medium | | 79 |Word Search| Solution | |Medium | Backtracking, DFS | 78 |Subsets| Solution || Medium |Backtracking | 77 |Combinations| Solution || Medium |Backtracking | 76 |Minimum Window Substring| Solution || Hard |Two Pointers | 75 |Sort Colors| Solution || Medium | Two Pointers | 74 |Search a 2D Matrix| Solution || Medium | Binary Search | 73 |Set Matrix Zeroes| Solution || Medium | | 72 |Edit Distance| Solution || Hard | | 71 |Simplify Path| Solution || Medium | Stack | 70 |Climbing Stairs| Solution | 📺 |Easy| DP | 69 |Sqrt(x)| Solution || Easy | | 68 |Text Justification| Solution || Hard | | 67 |Add Binary| Solution || Easy | | 66 |Plus One| Solution | 📺 |Easy| | 65 |Valid Number| Solution || Hard | | 64 |Minimum Path Sum| Solution || Medium | DP | 63 |Unique Paths II| Solution || Medium | DP | 62 |Unique Paths| Solution || Medium | DP | 61 |Rotate List| Solution || Medium | Linked List | 60 |Permutation Sequence| Solution || Medium | Math, Backtracking | 59 |Spiral Matrix II| Solution | 📺 |Medium| | 58 |Length of Last Word| Solution || Easy | | 57 |Insert Intervals| Solution || Hard | Array, Sort | 56 |Merge Intervals| Solution || Medium | Array, Sort | 55 |Jump Game| Solution || Medium | Greedy | 54 |Spiral Matrix| Solution | 📺 |Medium| Array | 53 |Maximum Subarray| Solution || Easy | Array | 52 |N-Queens II| Solution || Hard | Backtracking | 51 |N-Queens| Solution || Hard | | 50 |Pow(x, n)| Solution || Medium | | 49 |Group Anagrams| Solution || Medium | HashMap | 48 |Rotate Image| Solution | 📺 |Medium | Array | 47 |Permutations II| Solution || Medium |Backtracking | 46 |Permutations| Solution | |Medium | Backtracking | 45 |Jump Game II| Solution || Hard | Array, Greedy | 44 |Wildcard Matching| Solution || Hard | Backtracking, DP, Greedy, String | 43 |Multiply Strings| Solution || Medium | Array, String | 42 |Trapping Rain Water| Solution || Hard | | 41 |First Missing Positive| Solution || Hard | Array | 40 |Combination Sum II| Solution || Medium |Backtracking | 39 |Combination Sum| Solution || Medium |Backtracking | 38 |Count and Say| Solution || Easy | Recursion, LinkedList | 37 |Sudoku Solver| Solution || Hard | | 36 |Valid Sudoku| Solution, Javascript || Medium | | 35 |Search Insert Position| Solution || Easy |Array | 34 |Search for a Range| Solution || Medium |Array, Binary Search | 33 |Search in Rotated Sorted Array| Solution || Medium |Binary Search | 32 |Longest Valid Parentheses| Solution || Hard |Stack, DP | 31 |Next Permutation| Java, C++ || Medium |Array | 30 |Substring with Concatenation of All Words| Solution || Hard | HashMap | 29 |Divide Two Integers| Solution || Medium | | 28 |Implement strStr()| Solution || Easy | String | 27 |Remove Element| Solution | |Easy | | 26 |Remove Duplicates from Sorted Array| Solution | 📺 |Easy| Array | 25 |Reverse Nodes in k-Group| Solution | |Hard | Recursion, LinkedList | 24 |Swap Nodes in Pairs| Solution || Medium | Recursion, LinkedList | 23 |Merge k Sorted Lists| Solution | 📺 |Hard|Heap | 22 |Generate Parentheses| Solution || Medium |Backtracking | 21 |Merge Two Sorted Lists| Solution | 📺 |Easy| Recursion | 20 |Valid Parentheses| Solution | 📺 |Easy|Stack | 19 |Remove Nth Node From End of List| Solution | 📺 |Medium| Linked List | 18 |4 Sum| Solution || Medium |Two Pointers | 17 |Letter Combinations of a Phone Number| Solution || Medium |Backtracking | 16 |3Sum Closest| Solution || Medium |Two Pointers | 15 |3Sum| Solution, C++ | 📺 |Medium|Two Pointers, Binary Search | 14 |Longest Common Prefix| Solution | 📺 | Easy | 13 |Roman to Integer| Solution | |Easy | Math, String | 12 |Integer to Roman| Solution || Medium | Math, String | 11 |Container With Most Water| Solution || Medium | | 10 |Regular Expression Matching| Java, Javascript || Hard |DP | 9 |Palindrome Number| Java, C++ | | Easy | 8 |String to Integer (atoi)| Solution | |Medium | 7 |Reverse Integer| Solution, C++ | 📺 |Easy | | 6 |ZigZag Conversion| Solution | |Easy | | 5 |Longest Palindromic Substring| Solution | |Medium| | 4 |Median of Two Sorted Arrays| Solution, C++ | |Hard | Divide and Conquer | 3 |Longest Substring Without Repeating Characters| Solution, C++ | |Medium | HashMap, Sliding Window | 2 |Add Two Numbers| Solution | |Medium | LinkedList | 1 |Two Sum| Java, C++, Javascript | 📺 |Easy| HashMap