Skip to content

Latest commit

 

History

History
388 lines (387 loc) · 93 KB

File metadata and controls

388 lines (387 loc) · 93 KB

已经解决的 LeetCode 题目

ID Title Solution
1 Two Sum Code / Test
2 Add Two Numbers Code / Test
12 Integer to Roman Code / Test
17 Letter Combinations of a Phone Number Code / Test
20 Valid Parentheses Code / Test
29 Divide Two Integers Code / Test
42 Trapping Rain Water Code / Test
62 Unique Paths Code / Test
63 Unique Paths II Code / Test
66 Plus One Code / Test
67 Add Binary Code / Test
68 Text Justification Code / Test
71 Simplify Path Code / Test
85 Maximal Rectangle Code / Test
91 Decode Ways Code / Test
95 Unique Binary Search Trees II Code / Test
97 Interleaving String Code / Test
106 Construct Binary Tree from Inorder and Postorder Traversal Code / Test
110 Balanced Binary Tree Code / Test
122 Best Time to Buy and Sell Stock II Code / Test
123 Best Time to Buy and Sell Stock III Code / Test
129 Sum Root to Leaf Numbers Code / Test
132 Palindrome Partitioning II Code / Test
146 LRU Cache Code / Test
150 Evaluate Reverse Polish Notation Code / Test
151 Reverse Words in a String Code / Test
167 Two Sum II - Input Array Is Sorted Code / Test
175 Combine Two Tables Code / Test
191 Number of 1 Bits Code / Test
192 Word Frequency Code / Test
206 Reverse Linked List Code / Test
210 Course Schedule II Code / Test
222 Count Complete Tree Nodes Code / Test
233 Number of Digit One Code / Test
234 Palindrome Linked List Code / Test
240 Search a 2D Matrix II Code / Test
278 First Bad Version Code / Test
327 Count of Range Sum Code / Test
338 Counting Bits Code / Test
365 Water and Jug Problem Code / Test
371 Sum of Two Integers Code / Test
374 Guess Number Higher or Lower Code / Test
378 Kth Smallest Element in a Sorted Matrix Code / Test
385 Mini Parser Code / Test
396 Rotate Function Code / Test
399 Evaluate Division Code / Test
401 Binary Watch Code / Test
405 Convert a Number to Hexadecimal Code / Test
406 Queue Reconstruction by Height Code / Test
410 Split Array Largest Sum Code / Test
420 Strong Password Checker Code / Test
440 K-th Smallest in Lexicographical Order Code / Test
443 String Compression Code / Test
451 Sort Characters By Frequency Code / Test
456 132 Pattern Code / Test
459 Repeated Substring Pattern Code / Test
461 Hamming Distance Code / Test
464 Can I Win Code / Test
470 Implement Rand10() Using Rand7() Code / Test
496 Next Greater Element I Code / Test
497 Random Point in Non-overlapping Rectangles Code / Test
503 Next Greater Element II Code / Test
513 Find Bottom Left Tree Value Code / Test
519 Random Flip Matrix Code / Test
538 Convert BST to Greater Tree Code / Test
543 Diameter of Binary Tree Code / Test
575 Distribute Candies Code / Test
587 Erect the Fence Code / Test
589 N-ary Tree Preorder Traversal Code / Test
609 Find Duplicate File in System Code / Test
619 Biggest Single Number Code / Test
623 Add One Row to Tree Code / Test
640 Solve the Equation Code / Test
655 Print Binary Tree Code / Test
664 Strange Printer Code / Test
675 Cut Off Trees for Golf Event Code / Test
693 Binary Number with Alternating Bits Code / Test
695 Max Area of Island Code / Test
696 Count Binary Substrings Code / Test
705 Design HashSet Code / Test
712 Minimum ASCII Delete Sum for Two Strings Code / Test
719 Find K-th Smallest Pair Distance Code / Test
725 Split Linked List in Parts Code / Test
729 My Calendar I Code / Test
730 Count Different Palindromic Subsequences Code / Test
740 Delete and Earn Code / Test
744 Find Smallest Letter Greater Than Target Code / Test
756 Pyramid Transition Matrix Code / Test
761 Special Binary String Code / Test
799 Champagne Tower Code / Test
816 Ambiguous Coordinates Code / Test
829 Consecutive Numbers Sum Code / Test
837 New 21 Game Code / Test
839 Similar String Groups Code / Test
840 Magic Squares In Grid Code / Test
841 Keys and Rooms Code / Test
848 Shifting Letters Code / Test
865 Smallest Subtree with all the Deepest Nodes Code / Test
867 Transpose Matrix Code / Test
868 Binary Gap Code / Test
897 Increasing Order Search Tree Code / Test
898 Bitwise ORs of Subarrays Code / Test
915 Partition Array into Disjoint Intervals Code / Test
916 Word Subsets Code / Test
918 Maximum Sum Circular Subarray Code / Test
942 DI String Match Code / Test
944 Delete Columns to Make Sorted Code / Test
960 Delete Columns to Make Sorted III Code / Test
961 N-Repeated Element in Size 2N Array Code / Test
987 Vertical Order Traversal of a Binary Tree Code / Test
992 Subarrays with K Different Integers Code / Test
999 Available Captures for Rook Code / Test
1019 Next Greater Node In Linked List Code / Test
1022 Sum of Root To Leaf Binary Numbers Code / Test
1023 Camelcase Matching Code / Test
1036 Escape a Large Maze Code / Test
1037 Valid Boomerang Code / Test
1038 Binary Search Tree to Greater Sum Tree Code / Test
1045 Customers Who Bought All Products Code / Test
1053 Previous Permutation With One Swap Code / Test
1081 Smallest Subsequence of Distinct Characters Code / Test
1093 Statistics from a Large Sample Code / Test
1096 Brace Expansion II Code / Test
1106 Parsing A Boolean Expression Code / Test
1108 Defanging an IP Address Code / Test
1111 Maximum Nesting Depth of Two Valid Parentheses Strings Code / Test
1129 Shortest Path with Alternating Colors Code / Test
1161 Maximum Level Sum of a Binary Tree Code / Test
1195 Fizz Buzz Multithreaded Code / Test
1200 Minimum Absolute Difference Code / Test
1202 Smallest String With Swaps Code / Test
1203 Sort Items by Groups Respecting Dependencies Code / Test
1222 Queens That Can Attack the King Code / Test
1260 Shift 2D Grid Code / Test
1266 Minimum Time Visiting All Points Code / Test
1290 Convert Binary Number in a Linked List to Integer Code / Test
1292 Maximum Side Length of a Square with Sum Less than or Equal to Threshold Code / Test
1296 Divide Array in Sets of K Consecutive Numbers Code / Test
1297 Maximum Number of Occurrences of a Substring Code / Test
1314 Matrix Block Sum Code / Test
1317 Convert Integer to the Sum of Two No-Zero Integers Code / Test
1325 Delete Leaves With a Given Value Code / Test
1331 Rank Transform of an Array Code / Test
1351 Count Negative Numbers in a Sorted Matrix Code / Test
1356 Sort Integers by The Number of 1 Bits Code / Test
1357 Apply Discount Every n Orders Code / Test
1358 Number of Substrings Containing All Three Characters Code / Test
1365 How Many Numbers Are Smaller Than the Current Number Code / Test
1367 Linked List in Binary Tree Code / Test
1372 Longest ZigZag Path in a Binary Tree Code / Test
1382 Balance a Binary Search Tree Code / Test
1385 Find the Distance Value Between Two Arrays Code / Test
1390 Four Divisors Code / Test
1391 Check if There is a Valid Path in a Grid Code / Test
1400 Construct K Palindrome Strings Code / Test
1404 Number of Steps to Reduce a Number in Binary Representation to One Code / Test
1411 Number of Ways to Paint N × 3 Grid Code / Test
1417 Reformat The String Code / Test
1418 Display Table of Food Orders in a Restaurant Code / Test
1419 Minimum Number of Frogs Croaking Code / Test
1446 Consecutive Characters Code / Test
1458 Max Dot Product of Two Subsequences Code / Test
1461 Check If a String Contains All Binary Codes of Size K Code / Test
1499 Max Value of Equation Code / Test
1510 Stone Game IV Code / Test
1514 Path with Maximum Probability Code / Test
1519 Number of Nodes in the Sub-Tree With the Same Label Code / Test
1530 Number of Good Leaf Nodes Pairs Code / Test
1534 Count Good Triplets Code / Test
1536 Minimum Swaps to Arrange a Binary Grid Code / Test
1544 Make The String Great Code / Test
1545 Find Kth Bit in Nth Binary String Code / Test
1550 Three Consecutive Odds Code / Test
1559 Detect Cycles in 2D Grid Code / Test
1572 Matrix Diagonal Sum Code / Test
1574 Shortest Subarray to be Removed to Make Array Sorted Code / Test
1579 Remove Max Number of Edges to Keep Graph Fully Traversable Code / Test
1582 Special Positions in a Binary Matrix Code / Test
1589 Maximum Sum Obtained of Any Permutation Code / Test
1593 Split a String Into the Max Number of Unique Substrings Code / Test
1600 Throne Inheritance Code / Test
1622 Fancy Sequence Code / Test
1626 Best Team With No Conflicts Code / Test
1643 Kth Smallest Instructions Code / Test
1646 Get Maximum in Generated Array Code / Test
1653 Minimum Deletions to Make String Balanced Code / Test
1654 Minimum Jumps to Reach Home Code / Test
1662 Check If Two String Arrays are Equivalent Code / Test
1663 Smallest String With A Given Numeric Value Code / Test
1680 Concatenation of Consecutive Binary Numbers Code / Test
1681 Minimum Incompatibility Code / Test
1689 Partitioning Into Minimum Number Of Deci-Binary Numbers Code / Test
1712 Ways to Split Array Into Three Subarrays Code / Test
1725 Number Of Rectangles That Can Form The Largest Square Code / Test
1735 Count Ways to Make Array With Product Code / Test
1744 Can You Eat Your Favorite Candy on Your Favorite Day? Code / Test
1782 Count Pairs Of Nodes Code / Test
1800 Maximum Ascending Subarray Sum Code / Test
1802 Maximum Value at a Given Index in a Bounded Array Code / Test
1806 Minimum Number of Operations to Reinitialize a Permutation Code / Test
1815 Maximum Number of Groups Getting Fresh Donuts Code / Test
1819 Number of Different Subsequences GCDs Code / Test
1839 Longest Substring Of All Vowels in Order Code / Test
1850 Minimum Adjacent Swaps to Reach the Kth Smallest Number Code / Test
1877 Minimize Maximum Pair Sum in Array Code / Test
1880 Check if Word Equals Summation of Two Words Code / Test
1882 Process Tasks Using Servers Code / Test
1895 Largest Magic Square Code / Test
1896 Minimum Cost to Change the Final Value of Expression Code / Test
1897 Redistribute Characters to Make All Strings Equal Code / Test
1901 Find a Peak Element II Code / Test
1914 Cyclically Rotating a Grid Code / Test
1920 Build Array from Permutation Code / Test
1922 Count Good Numbers Code / Test
1926 Nearest Exit from Entrance in Maze Code / Test
1946 Largest Number After Mutating Substring Code / Test
1970 Last Day Where You Can Still Cross Code / Test
1974 Minimum Time to Type Word Using Special Typewriter Code / Test
1975 Maximum Matrix Sum Code / Test
1981 Minimize the Difference Between Target and Chosen Elements Code / Test
1984 Minimum Difference Between Highest and Lowest of K Scores Code / Test
1992 Find All Groups of Farmland Code / Test
2014 Longest Subsequence Repeated k Times Code / Test
2017 Grid Game Code / Test
2019 The Score of Students Solving Math Expression Code / Test
2022 Convert 1D Array Into 2D Array Code / Test
2025 Maximum Number of Ways to Partition an Array Code / Test
2037 Minimum Number of Moves to Seat Everyone Code / Test
2040 Kth Smallest Product of Two Sorted Arrays Code / Test
2054 Two Best Non-Overlapping Events Code / Test
2058 Find the Minimum and Maximum Number of Nodes Between Critical Points Code / Test
2070 Most Beautiful Item for Each Query Code / Test
2074 Reverse Nodes in Even Length Groups Code / Test
2087 Minimum Cost Homecoming of a Robot in a Grid Code / Test
2092 Find All People With Secret Code / Test
2140 Solving Questions With Brainpower Code / Test
2150 Find All Lonely Numbers in the Array Code / Test
2161 Partition Array According to Given Pivot Code / Test
2185 Counting Words With a Given Prefix Code / Test
2194 Cells in a Range on an Excel Sheet Code / Test
2201 Count Artifacts That Can Be Extracted Code / Test
2210 Count Hills and Valleys in an Array Code / Test
2215 Find the Difference of Two Arrays Code / Test
2235 Add Two Integers Code / Test
2244 Minimum Rounds to Complete All Tasks Code / Test
2257 Count Unguarded Cells in the Grid Code / Test
2260 Minimum Consecutive Cards to Pick Up Code / Test
2262 Total Appeal of A String Code / Test
2274 Maximum Consecutive Floors Without Special Floors Code / Test
2295 Replace Elements in an Array Code / Test
2321 Maximum Score Of Spliced Array Code / Test
2326 Spiral Matrix IV Code / Test
2335 Minimum Amount of Time to Fill Cups Code / Test
2383 Minimum Hours of Training to Win a Competition Code / Test
2392 Build a Matrix With Conditions Code / Test
2402 Meeting Rooms III Code / Test
2410 Maximum Matching of Players With Trainers Code / Test
2418 Sort the People Code / Test
2424 Longest Uploaded Prefix Code / Test
2435 Paths in Matrix Whose Sum Is Divisible by K Code / Test
2442 Count Number of Distinct Integers After Reverse Operations Code / Test
2457 Minimum Addition to Make Integer Beautiful Code / Test
2466 Count Ways To Build Good Strings Code / Test
2483 Minimum Penalty for a Shop Code / Test
2484 Count Palindromic Subsequences Code / Test
2488 Count Subarrays With Median K Code / Test
2500 Delete Greatest Value in Each Row Code / Test
2501 Longest Square Streak in an Array Code / Test
2520 Count the Digits That Divide a Number Code / Test
2530 Maximal Score After Applying K Operations Code / Test
2555 Maximize Win From Two Segments Code / Test
2563 Count the Number of Fair Pairs Code / Test
2601 Prime Subtraction Operation Code / Test
2611 Mice and Cheese Code / Test
2615 Sum of Distances Code / Test
2616 Minimize the Maximum Difference of Pairs Code / Test
2619 Array Prototype Last Code / Test
2627 Debounce Code / Test
2646 Minimize the Total Price of the Trips Code / Test
2673 Make Costs of Paths Equal in a Binary Tree Code / Test
2683 Neighboring Bitwise XOR Code / Test
2685 Count the Number of Complete Components Code / Test
2712 Minimum Cost to Make All Characters Equal Code / Test
2733 Neither Minimum nor Maximum Code / Test
2735 Collecting Chocolates Code / Test
2744 Find Maximum Number of String Pairs Code / Test
2786 Visit Array Positions to Maximize Score Code / Test
2801 Count Stepping Numbers in Range Code / Test
2835 Minimum Operations to Form Subsequence With Target Sum Code / Test
2844 Minimum Operations to Make a Special Number Code / Test
2850 Minimum Moves to Spread Stones Over Grid Code / Test
2861 Maximum Number of Alloys Code / Test
2870 Minimum Number of Operations to Make Array Empty Code / Test
2878 Get the Size of a DataFrame Code / Test
2879 Display the First Three Rows Code / Test
2895 Minimum Processing Time Code / Test
2913 Subarrays Distinct Element Sum of Squares I Code / Test
2937 Make Three Strings Equal Code / Test
2942 Find Words Containing Character Code / Test
2943 Maximize Area of Square Hole in Grid Code / Test
2954 Count the Number of Infection Sequences Code / Test
2975 Maximum Square Area by Removing Fences From a Field Code / Test
2976 Minimum Cost to Convert String I Code / Test
2977 Minimum Cost to Convert String II Code / Test
3006 Find Beautiful Indices in the Given Array I Code / Test
3007 Maximum Number That Sum of the Prices Is Less Than or Equal to K Code / Test
3035 Maximum Palindromes After Operations Code / Test
3047 Find the Largest Area of Square Inside Two Rectangles Code / Test
3074 Apple Redistribution into Boxes Code / Test
3075 Maximize Happiness of Selected Children Code / Test
3077 Maximum Strength of K Disjoint Subarrays Code / Test
3080 Mark Elements on Array by Performing Queries Code / Test
3098 Find the Sum of Subsequence Powers Code / Test
3117 Minimum Sum of Values by Dividing Array Code / Test
3165 Maximum Sum of Subsequence With Non-adjacent Elements Code / Test
3168 Minimum Number of Chairs in a Waiting Room Code / Test
3217 Delete Nodes From Linked List Present in Array Code / Test
3223 Minimum Length of String After Operations Code / Test
3254 Find the Power of K-Size Subarrays I Code / Test
3258 Count Substrings That Satisfy K-Constraint I Code / Test
3264 Final Array State After K Multiplication Operations I Code / Test
3286 Find a Safe Walk Through a Grid Code / Test
3290 Maximum Multiplication Score Code / Test
3291 Minimum Number of Valid Strings to Form Target I Code / Test
3298 Count Substrings That Can Be Rearranged to Contain a String II Code / Test
3314 Construct the Minimum Bitwise Array I Code / Test
3315 Construct the Minimum Bitwise Array II Code / Test
3326 Minimum Division Operations to Make Array Non Decreasing Code / Test
3335 Total Characters in String After Transformations I Code / Test
3350 Adjacent Increasing Subarrays Detection II Code / Test
3362 Zero Array Transformation III Code / Test
3364 Minimum Positive Sum Subarray Code / Test
3379 Transformed Array Code / Test
3380 Maximum Area Rectangle With Point Constraints I Code / Test
3381 Maximum Subarray Sum With Length Divisible by K Code / Test
3398 Smallest Substring With Identical Characters I Code / Test
3405 Count the Number of Arrays with K Matching Adjacent Elements Code / Test
3408 Design Task Manager Code / Test
3409 Longest Subsequence With Decreasing Adjacent Difference Code / Test
3418 Maximum Amount of Money Robot Can Earn Code / Test
3430 Maximum and Minimum Sums of at Most Size K Subarrays Code / Test
3433 Count Mentions Per User Code / Test
3451 Find Invalid IP Addresses Code / Test
3453 Separate Squares I Code / Test
3454 Separate Squares II Code / Test
3463 Check If Digits Are Equal in String After Operations II Code / Test
3470 Permutations IV Code / Test
3482 Analyze Organization Hierarchy Code / Test
3498 Reverse Degree of a String Code / Test
3505 Minimum Operations to Make Elements Within K Subarrays Equal Code / Test
3507 Minimum Pair Removal to Sort Array I Code / Test
3510 Minimum Pair Removal to Sort Array II Code / Test
3516 Find Closest Person Code / Test
3533 Concatenated Divisibility Code / Test
3536 Maximum Product of Two Digits Code / Test
3546 Equal Sum Grid Partition I Code / Test
3561 Resulting String After Adjacent Removals Code / Test
3592 Inverse Coin Change Code / Test
3593 Minimum Increments to Equalize Leaf Paths Code / Test
3597 Partition String Code / Test
3634 Minimum Removals to Balance Array Code / Test
3637 Trionic Array I Code / Test
3638 Maximum Balanced Shipments Code / Test
3650 Minimum Cost Path with Edge Reversals Code / Test
3651 Minimum Cost Path with Teleportations Code / Test
3653 XOR After Range Multiplication Queries I Code / Test
3654 Minimum Sum After Divisible Sum Deletions Code / Test
3658 GCD of Odd and Even Sums Code / Test
3684 Maximize Sum of At Most K Distinct Elements Code / Test
3709 Design Exam Scores Tracker Code / Test
3713 Longest Balanced Substring I Code / Test
3719 Longest Balanced Subarray I Code / Test
3721 Longest Balanced Subarray II Code / Test
3722 Lexicographically Smallest String After Reverse Code / Test
3727 Maximum Alternating Sum of Squares Code / Test
3729 Count Distinct Subarrays Divisible by K in Sorted Array Code / Test
3742 Maximum Path Score in a Grid Code / Test
3755 Find Maximum Balanced XOR Subarray Length Code / Test
3771 Total Score of Dungeon Runs Code / Test
3774 Absolute Difference Between Maximum and Minimum K Elements Code / Test
3782 Last Remaining Integer After Alternating Deletion Operations Code / Test
3789 Minimum Cost to Acquire Required Items Code / Test
3791 Number of Balanced Integers in a Range Code / Test
3813 Vowel-Consonant Score Code / Test