Skip to content

Latest commit

History

460 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

some interesting topic about Rust on leetcode

use rustc source code to solve leetcode

leetcode-rust package require rustc_private feature to enable rustc relative API

e.g. use rustc_span::lev_distance::lev_distance(&a, &b) one line to solve leetcode edit-distance (Unfortunately we can't use nightly and rustc-dev in leetcode)

use rustc_graphviz visualize leetcode binary tree

graphviz_leetcode_binary_tree.png


codeforces_solutions

ProblemSolution
1A - Theatre SquareRust
4A - WatermelonRust
71A - Way Too Long WordsRust
158A - Next RoundRust
231A - TeamRust

leetcode_solutions

(problem number with 🔒 suffix need leetcode VIP to unlock)

#ProblemSolutionsCategory/Comment
1Two SumRust, Javabitwise
2Add Two NumbersRust, Java, Golinked_list
3Longest Substring Without Repeating Char...Rustsliding_window
4Median of Two Sorted ArraysRust, Pythonbinary_search
5Longest Palindromic SubstringRust, Pythonmanacher, suffix_array
6ZigZag ConversionRust
7Reverse IntegerRust
8String to Integer (atoi)Python
9Palindromic NumberRust
10Regular Expression MatchingPython
11Container With Most WaterRust
12Integer to RomanRust
13Roman to IntegerRust
14Longest Common PrefixPython
153SumPythontwo_pointers, two_sum
163Sum ClosestPythontwo_sum
17Letter Combinations of a Phone NumberRustBFS
184SumPythontwo_pointers, two_sum
19Remove Nth Node From End of ListRustsliding_window
20Valid ParenthesesPythonstack
21Merge Two Sorted ListsRust, Python
22Generate ParenthesesPythonbacktracking
23Merge k Sorted ListsPython
24Swap Nodes in PairsRust
26Remove Duplicates from Sorted ArrayRust
27Remove ElementRust
28Implement strStr()Rust, Pythonkmp, dfa
31Next PermutationPython
33Search in Rotated Sorted ArrayPythonbinary_search
34Find First and Last Position of Element ...Rust
35Search Insert PositionRust
36Valid SudokuPython
37Soduku SolverPython
38Count And SayRust
39Combination SumPython, Rust
40Combination Sum IIPython, Rust
42Trapping Rain WaterRust
44Wildcard MatchingPython
45Jump Game IIRustgreedy
46PermutationsRust
47Permutations IIRust
48Rotate ImageRust
49Group AnagramsRust
50Pow(x, n)Rust
51N QueensPython, Rust
52N Queens IIPython, Rust
53Maximum SubarrayRust
54Spiral MatrixRust
55Jump GamePythongreedy, dp
58Length of Last WordRust
59Spiral Matrix IIRust
60Permutation SequencePython
62Unique PathsRust, Gocombination
63Unique Paths IIPython
64Minimum Path SumPython
65Valid NumberRust
66Plus OneRust
67Add BinaryC++
69Sqrt(x)Rust
70Climb StairsRustfibonacci
72Edit DistanceRust
73Set Matrix ZeroesRust
74Search a 2D MatrixRust
75Sort ColorsPythonthree_pointers, partition_array
77CombinationsRust
78SubsetsRust
79Word SearchPython
81Search in Rotated Sorted Array IIPythonbinary_search
82Remove Duplicates from Sorted List IIC++
83Remove Duplicates from Sorted ListC++
86Partition ListRust
88Merge Sorted ArrayRust, Pythonmerge_sort
89Gray CodeRust
90Subsets IIPython
91Decode WaysPython
92Reverse Linked List IIPython
93Restore IP AddressesRust
94Binary Tree Inorder TraversalPythonDFS, stack
98Validate Binary Search TreeRust
99Recover Binary Search TreePython
100Same TreeRust
102Binary Tree Level Order TraversalRust, Python
103Binary Tree Zigzag Level Order TraversalRust
104Maximum Depth of Binary TreeRust
105Construct Binary Tree from Preorder and Inorder TraversalPythonDFS, stack
106Construct Binary Tree from Inorder and Postorder TraversalPythonDFS
107Binary Tree Level Order Traversal IIRust
108Convert Sorted Array to Binary Search TreePythondivide_and_conquer
109Convert Sorted List to Binary Search TreePythondivide_and_conquer
110Balanced Binary TreePythondivide_and_conquer
111Minimum Depth of Binary TreePythondivide_and_conquer, BFS
114Flatten Binary Tree to Linked ListPython
118Pascals TrianglePython
119Pascals Triangle IIPython
120TriangleRust
121Best Time to Buy and Sell StockPython
122Best Time to Buy and Sell Stock IIPython
123Best Time to Buy and Sell Stock IIIPython
124Binary Tree Maximum Path SumPython
125Valid PalindromePythontwo_pointers
126Word Ladder IIPythonBFS+DFS
127Word LadderPython双向BFS
128Longest Consecutive SequencePython并查集
129Sum Root to Leaf NumbersRust
130Surrounded RegionsRust
133Clone GraphPythonDFS, BFS
134Gas StationRust
135CandyRust
136Single NumberRust
137Single Number IIRust
138Copy List with Random PointerPython
139Word BreakPython完全背包问题
140Word Break IIPython
141Linked List CyclePython
142Linked List Cycle IIPython
144Binary Tree Preorder TraversalRust
145Binary Tree Postorder TraversalPythonDFS, stack
146LRU CachePythondouble_linked_list, OrderedDict
147Insertion Sort ListRust
148Sort ListRust
150Evaluate Reverse Polish NotationRust
151Reverse Words in a StringRust
153Find Minimum in Rotated Sorted ArrayPythonbinary_search
154Find Minimum in Rotated Sorted Array IIPythonbinary_search
155Min StackPython
160Intersection of Two Linked ListsPython
164Maximum GapRust
165Compare Version NumbersRust
167Two Sum II - Input array is sortedPythontwo_pointers
168Excel Sheet Column TitleRust
169Majority ElementRust
170🔒Two Sum III - Data structure designPythontwo_pointers
171Excel Sheet Column NumberRust
172Factorial Trailing ZeroesRust
173Binary Search Tree IteratorPython
174Dungeon GameRust
175Combine Two Tables
176Second Highest SalarySQL
181Employees Earning More Than Their ManagersSQL
182Duplicate EmailsSQL
183Customers Who Never Ordersql
188Best Time to Buy and Sell Stock IVPython
189Rotate ArrayRust
190Reverse BitsRust
191Number of 1 BitsRust
198House RobberPython
200Number of IslandsPythonspecial_data_structure.union_find, DFS, BFS
202Happy NumberPython
203Remove Linked List ElementsPython
204Count PrimesRust
206Reverse Linked ListPython, Rust
208Implement Trie (Prefix Tree)Rust
207Course Schedulesame as 210
209Minimum Size Subarray SumPythonsliding_window
210Course Schedule IIRust, Python
211Design Add and Search Words..Rust
212Word Search IIPython前缀树
213House Robber IIPython
215Kth Largest Element in an ArrayPythonquick_select, quick_sort, heap
216Combination Sum IIIRust
217Contains DuplicateRust
219Contains Duplicate IIRust
222Count Complete Tree NodesRust
224Basic CalculatorRust
225Implement Stack using QueuesPython
226Invert Binary TreeRust
227Basic Calculator IIRust
228Summary RangesRust
230Kth Smallest Element in a BSTPythonDFS, stack
231Power of TwoRust
232Implement Queue using StacksPython
234Palindrome Linked ListRust
235Lowest Common Ancestor of a Binary Search TreePython
236Lowest Common Ancestor of a Binary TreePythondivide_and_conquer
238Product of Array Except SelfRust
239Sliding Window MaximumRust
240Search a 2D Matrix IIPython
242Valid AnagramRust
257Binary Tree PathsPythonDFS, backtracking
258Add DigitsRust
260Single Number IIIRust
263Ugly NumberRust
264Ugly Number IIPython
266🔒Palindrome PermutationPythongreedy
269🔒Alien DictionaryPythonheapq, topological_sorting
270🔒Closest Binary Search Tree ValuePython
272🔒Closest Binary Search Tree Value IIPython
278First Bad VersionRust
279Perfect SquaresRust
283Move ZerosRust
287Find the Duplicate NumberPython快慢双指针
290Word PatternRust
291🔒Word Pattern IIPythonDFS
292Nim GameRust
295Find Median from Data StreamRust
297Serialize and Deserialize Binary TreePythonserialize
300Longest Increasing SubsequencePython接龙型动态规划
302🔒Smallest Rectangle Enclosing Black PixelsPython
303Range Sum Query - ImmutableRust
304Range Sum Query 2D - ImmutableRust
307Range Sum Query - MutablePython
309Best Time to Buy and Sell Stock with CooldownPython
311🔒Sparse Matrix MultiplicationRust
312Burst BalloonsRust
322Coin ChangeRust
326Power of ThreeRust
328Odd Even Linked ListPython
337House Robber IIIPython
338Counting BitsRust
341Flatten Nested List IteratorRust
342Power of FourRust
343Integer BreakPython划分类DP
344Reverse StringRust
345Reverse Vowels of a StringRust
347Top K Frequent ElementsRust
349Intersection of Two ArraysPython
350Intersection of Two Arrays IIPython
354Russian Doll EnvelopesPython
355Design TwitterRust
359🔒Logger Rate LimiterRust
367Valid Perfect SquareRust
368Largest Divisible SubsetPython
369🔒Plus One Linked ListRust
371❌Sum of Two IntegersPythonbinary_addition
374Guess Number Higher Or LowerRust
377Combination Sum IVRust
380Insert Delete GetRandom O(1)Python
381Insert Delete GetRandom O(1) - Duplicates allowedPython
383Ransom NoteRust
386Lexicographical NumbersRust
387First Unique Character in a StringRust
389Find The DifferenceRust
398Random Pick IndexRust
404Sum of Left LeavesRust
406Queue Reconstruction by HeightRust
409Longest PalindromePythondp(greedy)
412Fizz BuzzRust
413Arithmetic SlicesRust
415Add StringC++
416Partition Equal Subset SumPython0-1背包问题
426Longest Repeating Character ReplacementPython
429N-ary Tree Level Order TraversalC++
448Find All Numbers Disappeared in an ArrayRust
449Serialize and Deserialize BSTPythonDFS, stack
451Sort Characters By FrequencyRust
4544Sum IIRust
455Assign CookiesRust
457Circular Array LoopRust
461Hamming DistanceRust
463Island PerimeterRust
470impl rand10 using rand7Rust
474Ones and ZeroesPython完全背包问题
477Total Hamming DistanceRust
480Sliding Window MedianRust
485Max Consecutive OnesRust
486Validate IP AddressRust
490🔒The MazeRust
494Target SumPython0-1背包问题
498Diagonal TraverseRust
500Keyboard RowRust
503Next Greater Element IIRust
504Base 7Rust
507Perfect NumberRust
509Fibonacci NumberRust
514Freedom TrailRust
515Find Largest Value...Rust
518Coin Change 2Rust
523Continuous Subarray SumRust
525Contiguous ArrayRust
535Encode and Decode TinyURLvery_easy
536🔒Construct Binary Tree from StringPython
538Convert BST to Greater TreePython
540Single Element in a Sorted ArrayRust
541Reverse String IIRust
547Friend CirclesRust
554Brick WallRust
557Reverse Words in a String IIIRust
559Maximum Depth of N-ary TreeC++
566Reshape the MatrixRust
575Distribute CandiesRust
589N-ary Tree Preorder TraversalPython
590N-ary Tree Postorder TraversalPython
593Valid SquareRust
595Big Countriessql
606Construct String from Binary TreePython
617Merge Two Binary TreesRust
605Can Place FlowersRust
610🔒Triangle JudgementSQL
611Valid Triangle NumberRust
613🔒Shortest Distance in a LineSQL
620Not Boring MoviesSQL
625🔒Minimum FactorizationPythongreedy
627Swap SalarySQL
628Maximum Product of Three NumbersRust
633Average of Levels in Binary TreePython
643Maximum Average Subarray IRust
645Set MismatchRust
6502 Keys KeyboardRust
653Tow Sum IV - Input is a BSTPython
657Robot Return to OriginRust
658Find K Closest ElementsRust, Pythonbinary_search
661Image SmootherRust
669Trim A Binary Search TreePython
674Longest Continuous Increasing SubsequencePython
680Valid Palindrome IIPythontwo_pointers, greedy
682Baseball GameRust
690Employee Importancejava
692Top K Frequent WordsRust
693Binary Number With Alternating BitsRust
695Max Area of IslandRust
696Count Binary SubstringsRust
700Search in a Binary Search TreeRust
702🔒Search in a Sorted Array of Unknown SizePythonbinary_search_first, 倍增法
703Kth Largest Element in a StreamRust
704Binary SearchRust
705Design HashSetPython
706Design HashMapPython
709To Lower CaseRust
7131-bit and 2-bit CharactersRust
714Best Time to Buy and Sell Stock with Transaction FeePython
716🔒Max StackPython
724Find Pivot IndexRust
728Self Dividing NumbersRust
743Network Delay TimeRust
746Min Cost Climbing StairsRust
760🔒Find Anagram MappingsRust
763Partition LabelsRust
766Toeplitz MatrixRust
771Jewels and StonesRust
787Cheapest Flights Within K StopsRust
788Rotated DigitsRust
796Rotate StringPythonRabin-Karp(rolling_hash), kmp
797All Paths From Source to TargetRust
807Max Increase to Keep City SkylineRust
830Positions of Large GroupsRust
832Flipping an ImageRust
841Keys and RoomsRust
844Backspace String CompareRust
845Longest Mountain in ArrayPythonmountain_array
852Peak Index in a Mountain ArrayRust
860Lemonade ChangeRust
861Score After Flipping MatrixPythongreedy
867Transpose MatrixRust, Go
869Reordered Power of 2Pythonpermutation
872Leaf Similar TreesRust
875Koko Eating BananasPython
876Middle of the Linked ListRust
877Stone GameRust
881Boats to Save PeopleRust
887Super Egg DropRust
888Fair Candy SwapRust
889Construct Binary Tree from Preorder and Postorder...PythonDFS
905Sort Array By ParityRust
912Sort An ArrayPython
914Partition Array Into Disjoint...Rust
922Sort Array By Parity IIRust
925Long Pressed NameRust
930Binary Subarrays With SumRust
938Range Sum of BSTRust
941Valid Mountain ArrayPythonmountain_array
942DI String MatchRust
944Delete Columns to Make SortedRust
950Reveal Cards In Increasing OrderRust
953Verifying an Alien DictionaryPython
961N-Repeated Element in Size 2N ArrayRust
965Univalued Binary TreeRust
973K Closest Points to OriginRustquick_select
976Largest Perimeter TriangleRust
977Squares of a Sorted ArrayRust
989Add to Array-Form of IntegerRust
993Cousins In Binary TreeRust
1002Find Common CharactersRust
1006Clumsy FactorialRust
1018Binary Prefix Divisible By 5Rust
1030Matrix Cells in Distance OrderRust
1038Binary Search Tree to Greater Sum TreePython
1046Last Stone WeightPython
1049Last Stone Weight IIPython0-1背包问题
1051Height CheckerRust
1068🔒Product Sales Analysis ISQL
1069🔒Product Sales Analysis IISQL
1079Letter Tile Possibilities/Rust
1089Duplicate ZerosRust
1095Find in Mountain ArrayPythonbinary_search, mountain_array
1099🔒Two Sum Less Than KPythontwo_pointers
1108Defanging an IP AddressRust
1128Number of Equivalent Domino PairsRust
1109Corporate Flight BookingsRust
1119🔒Remove Vowels from a StringRust
1134🔒Armstrong NumberRust
1143Longest Common SubsequencePython
1160Find Words That Can Be Formed by Ch...Rust
1167🔒Minimum Cost To Connect SticksRust
1180🔒Count Substrings with Only One Distinct LetterRust
1189Maximum Number of BalloonsRust
1207Unique Number of OccurrencesRust
1213🔒Intersection of Three Sorted ArraysRust
1221Split a String In..Rust
1226The Dining PhilosophersC++
1227Airplane Seat Assignment ProbabilityRust
1232Check If It Is a Straight LineRust
1248Count Number of Nice SubarraysRust
1251🔒Average Selling PriceSQL
1252Cells with Odd Values in a MatrixRust
1260Shift 2D GridRust
1265🔒Print Immutable Linked List in ReverseC
1266Minimum Time Visiting All PointsRust
1269Number of Ways to Stay in the Same...Rust
1281Subtract the Product and Sum of Digits...Rust
1282Group the people...Rust
1295Find Numbers with Even Number of DigitsRust
1299Replace Elements with Greatest Element on Right...Rust
1302Deepest Leaves SumRust
1303🔒Find the Team SizeSQL
1313Decompress Run-Length Encoded ListPython
1329Sort The Matrix DiagonallyRust
1331Rank Transform Of An ArrayRust
1337The K Weakest Rows in a MatrixRust
1342Number of Steps to Reduce a Number to ZeroRust
1346Check If N and Its Double ExistRust
1351Count Negative Numbers in a Sorted MatrixRust
1356Sort Integers by The Number of 1 BitsRust
1365How Many Numbers Are Smaller Than the Current NumberRust
1370Increasing Decreasing StringRust
1374Generate a String With Characters That Have Odd CountsRust
1379Find a Corresponding Node of a Binary Tree ...Python
1380Lucky Numbers in a MatrixRust
1389Create Target Array in the Given OrderRust
1395Count Number of TeamsRust
1403Minimum Subsequence...Rust
1409Queries on a Permutation With KeyRust
1418Display Table Of Food Order..Rust
1429🔒First Unique NumberPython
1431Kids With the Greatest Number of CandiesRust
1436Destination CityRust
1441Build An Array With Stack Op...Rust
1445🔒Apples OrangesSQL
1450Number of Students Doing Homework at ...Rust
1464Maximum Product of Two Elements in an ArrayRust
1470Shuffle the ArrayRust
1475Final Prices With a Special Discount...Rust
1476Subrectangle QueriesRust
1480Running Sum of 1d ArrayRust
1486XOR Operation in an ArrayRust, Racket
1502Can Make Arithmetic Progression From SequenceRust
1512Number of Good PairsRust
1528Shuffle StringRust
1534Count Good TripletsRust
1551Minimum Operations to Make Array EqualRust
1570Dot Product of Two Sparse VectorsRust
1572Matrix Diagonal SumRust
1576Replace All ?'s to Avoid Consecutive ...Rust
1577Number of Ways Where Square of ...Rust
1578Minimum Deletion Cost to Avoid Repeating ...Rust
1582Special Positions in a Binary MatrixRust
1584Min Cost to Connect All PointsRust
1588Sum of All Odd Length SubarraysRust
1592Rearrange Spaces Between WordsRust
1598Crawler Log FolderRust
1601Design Parking SystemRust
1614Maximum Nesting Depth of the ParenthesesRust
1619Mean Of Array...Rust
1636Sort Array by Increasing FrequencyRust
1637Widest Vertical Area Between Two Points ...Rust
1640Check Array Formation Through ConcatenationRust
1641Count Sorted Vowel...Rust
1646Get Maximum In Gen...Rust
1656Design an Ordered StreamRust
1658Defuse The BombRust
1662Check If Two String Arrays are EquivalentRust
1668Maximum Repeating SubstringRust
1672Richest Customer WealthRust
1678Goal Parser InterpretationRust
1683🔒Invalid TweetsSQL
1684Count the Number of Consistent StringsRust
1688Count of Matches in TournamentRust
1694Reformat Phone NumberRust
1700Number of Students Unable to Eat LunchRust
1704Determine If String...Rust
1710Maximum Units on a TruckRust
1711Count Good MealsRust
1716Calculate Money in Leetcode BankRust
1720Decode XORed ArrayRust
1725Number Of Rectangles That Can ...Rust
1732Find the Highest AltitudeRust
1736Latest Time by Replacing ...Rust
1741🔒Find Total Time Spent by Each EmployeeSQL
1742Maximum Number of Ball...Rust
1744Can You Eat Your Favorite Candy...Rust
1748Sum of Unique ElementsRust
1752Check if Array Is Sorted and RotatedRust
1753Maximum Score From Removing StonesRust
1754Largest Merge Of Two StringsRust
1773Count Items Matching a RuleRust
1779Find Nearest...Rust
1790Check if One String Swap Can Make String...Rust
1791Find Center of Star GraphRust
1796Second Largest...Rust
1805Number Of Diff...Rust
1812Determine Color...Rust
1816Truncate SentenceRust
1822Sign Of The Product...Rust
1828Queries on Number of Points Inside a CircleRust
1832Check if the Sentence Is PangramRust
1833Maximum Ice Cream BarsRust
1834Single Threaded CpuRust
1837Sum of Digits in Base KRust
1839Longest Substring Of All Vowels in OrderRust
1844Replace All Digits with CharactersRust
1845Seat Reservation ManagerRust
1848Minimum Distance to the...tRust
1854Maximum Population YearRust
1863Sum of All Subset XOR TotalsRust
1877Minimize Maximum Pair...Rust
1880Check if Word Equals...Rust
1893Check if All The Integer...Rust
1913Maximum Product Diff...Rust
1920Build Array from PermutationRust
1925Count Square Sum TriplesRust
1929Concatenation of ArrayRust
1952Three DivisorsRust
1984Minimum Difference Between...Rust
1985Find The Kth Large...Rust
1995Count Special QuadrupletsRust
2000Count Special QuadrupletsRust
2011Find Value Of...Rust
2027Minimum moves...Rust
2032Two Out Of ThreeRust
2042Check If Numbers...Rust
2057Smallest Index With Equal ValueRust
2114Maximum Number of...Rust
2169Count Operations to Obtain ZeroRust
2180Count Integer...Rust
2283Check If Number...Rust
2299Strong Password Checker IIRust
2319Check If Matrix...Rust
2325Decode The MessageRust
2331Evaluate Boolean Binary TreeRust
2335Minimum Amount of Time to Fill CupsRust
2341Maximum number of...Rust
2347Best Poker HandRust
2357Make Array...Rust
2367Number Of...Rust
2404Most Fre...Rust
2413Smallest Even...Rust
2441Largest Positive...Rust
2455Average...Rust
2469Convert The...Rust
2490Circular SentenceRust
2600K Items...Rust

剑指Offer(lcof) && LCP(Leetcode Competition Programing)

#TitleSolutionsCategory
LCP.7传递信息Rust
59队列的最大值Python
60n个骰子的点数Python
61扑克牌中的顺子Python
62圆圈中最后剩下的数字Python约瑟夫环

#TitleSolutionsCategory
1A + B Problemleetcode_372
3Digit CountsPython
5Kth Largest ElementPythonquick_select, heap
20Dices SumPython
31Partition ArrayPythontwo_pointers
40Implement Queue by Two StacksPython
52Next PermutationPython
76Longest Increasing SubsequencePython接龙型动态规划
77Longest Common SubsequencePython
79Longest Common SubstringPython
80MedianPythonquick_select
86Binary Search Tree IteratorPython
88Lowest Common Ancestor of a Binary TreePythondivide_and_conquer
90k Sum IIPython
92BackpackPython
93Balanced Binary TreePythondivide_and_conquer
95Validate Binary Search TreePython
105Copy List with Random PointerPython
106Convert Sorted List to Binary Search TreePythondivide_and_conquer
107Word BreakPython完全背包问题
110Minimum Path SumPython
124Longest Consecutive SequencePython并查集
125Backpack IIPython
127Topological SortingPythonBFS, topological_sorting
128Hash FunctionPython
129RehashingPython
135Combination SumPython, Rust
137Clone GraphPythonDFS, BFS
138Subarray SumPython
143Sort Colors IIPythonquick_sort, counting_sort
144interleaving_positive_and_negative_numbersPython
147🔒Narcissistic NumberPython
148Sort ColorsPythonthree_pointers, partition_array
153Combination Sum IIPython, Rust
160Find Minimum in Rotated Sorted Array IIPythonbinary_search
161Rotate ImageRust
168Burst BalloonsPython
171AnagramsPython
177Convert Sorted Array to Binary Search Tree With Minimal HeightPythondivide_and_conquer
183Wood CutPythongreedy
190Next Permutation IIPython
192Wildcard MatchingPython
197Permutation IndexPython
235Prime FactorizationPython分解质因数
249Count of Smaller Number before itselfPythonsqrt_n
254Drop EggsPythonsqrt_n
272🔒Climbing Stairs IIPython
376Binary Tree Path SumPythonDFS, backtracking
380Intersection of Two Linked ListsPython
386Longest Substring with At Most K Distinct CharactersPython
388Permutation SequencePython
393Best Time to Buy and Sell Stock IVPython
397Longest Continuous Increasing SubsequencePython
406Minimum Size Subarray SumPythonsliding_window
415Valid PalindromePythontwo_pointers
437Copy BooksPythondp, binary_search
440🔒Backpack IIIPython
443🔒Two Sum - Greater than targetPythontwo_pointers
447🔒Search in a Big Sorted ArrayPythonbinary_search_first, 倍增法
453Flatten Binary Tree to Linked ListPython
461Kth Smallest Numbers in Unsorted ArrayPython
464Sort Integers IIPython
466Count Linked List Nodestoo_easy
474🔒Lowest Common Ancestor IIPython
476Stone Game(diff to leetcode)Python
480Binary Tree PathsPythonDFS, backtracking
486Merge K Sorted ArraysPython
492Implement Queue by Linked ListPython
494Implement Stack by Two QueuesPython
495Implement StackPython
512Decode WaysPython
521🔒Remove Duplicate Numbers in ArrayPythonpartition_array
533🔒Two Sum - Closest to targetPythontwo_sum
544Top k Largest NumbersPythonmin_heap
545Top k Largest Numbers IIPythonmin_heap
547Intersection of Two ArraysPython
548Intersection of Two Arrays IIPython
562Backpack IVPython完全背包问题
563Backpack VPython
577Merge k Sorted Interval ListsPython
578Lowest Common Ancestor IIIPython
584Drop Eggs IIRustdp
587🔒Two Sum - Unique pairsPythontwo_sum
588Partition Equal Subset SumPython0-1背包问题
594Implement strStr() IIPythonkmp, Rabin-Karp(rolling_hash)
596🔒Minimum SubtreePythondivide_and_conquer
600Smallest Rectangle Enclosing Black PixelsPython
603Largest Divisible SubsetPython
606Kth Largest Element IIPythonquick_select, quick_sort, heap
607Two Sum III - Data structure designPythontwo_pointers
608Two Sum II - Input array is sortedPythontwo_pointers
609Two Sum - Less than or equal to targetPythontwo_pointers
610Two Sum - Difference equals to targetPythontwo_pointers
611🔒Knight Shortest PathPythonbfs
627Longest Palindromic CombinationPythongreedy
628Maximum SubtreePythondivide_and_conquer
630🔒Knight Shortest Path IIPythonbfs
633Find the Duplicate NumberPython快慢双指针
657Insert Delete GetRandom O(1)Python
661Convert BST to Greater TreePython
667Longest Palindromic SubsequencePythondp(greedy)
683Word Break IIIPython
685First Unique Number in Data StreamPython
691Recover Binary Search TreePython
701Trim A Binary Search TreePython
702Russian Doll EnvelopesPython
719Calculate Maximum ValuePython
724Minimum PartitionPython0-1背包问题
741Calculate Maximum Value IIPython
749John's backyard gardenPython
793Intersection of ArraysPython
802Soduku SolverPython
816Traveling Salesman ProblemPython
839Merge Two Sorted Interval ListsPython
841String ReplacePython
845Greatest Common DivisorPython
859Max StackPython
871Minimum FactorizationPythongreedy
891Valid Palindrome IIPythontwo_pointers, greedy
892Alien DictionaryPythonheapq, topological_sorting
900Closest Binary Search Tree ValuePython
901Closest Binary Search Tree Value IIPython
902Kth Smallest Element in a BSTPythonDFS, stack
954Insert Delete GetRandom O(1) - Duplicates allowedPython
995Best Time ... Stock with CooldownPython
1147Work PlanPython
1208Target SumPython0-1背包问题
1276Sum of Two IntegersPythonbinary_addition
1284Integer BreakPython划分类DP
1311Lowest Common Ancestor of a Binary Search TreePython
1343Sum of Two StringsPython
1359Convert Sorted Array to Binary Search TreePythondivide_and_conquer
1375Substring With At Least K Distinct CharactersPython
1479Can Reach The EndpointPythonbfs
1499Reordered Power of 2Pythonpermutation
1508Score After Flipping MatrixPythongreedy
1790🔒Rotate String IIPythonreverse, circle_shift
1870number of substrings with all zeroesPython

todo_dp:

  • 划分型动态规划:戳气球、石子归并(dp/stone_game_merge.py)
  • 选或不选类DP: 打家劫舍系列/股票买卖系列
  • 计数型动态规划: k sum
  • 43/415 字符串整数相乘/相加
  • 415是经典面试题利用字符串模拟竖式加法进行大数相加
  • 有兴趣但是困难级别的题: 1. 推箱子 2. 华容道
  • [ ]最大直方图矩阵(Longest Histogram Rectangle), 单调栈O(n^3)->O(n)

some awesome leetcode rust solutions repos

other awesome leetcode repos I recommend

About

leetcode/codeforces Rust solution with unittest, leetcode-rust and codeforces-rust

Resources

Stars

69 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages