liuyubobobo/Play-Leetcode

My Solutions to Leetcode problems. All solutions support C++ language, some support Java and Python. Multiple solutions will be given by most problems. Enjoy:) 我的Leetcode解答。所有的问题都支持C++语言,一部分问题支持Java语言。近乎所有问题都会提供多个算法解决。大家加油!:)

C++

2,720

2,588 commits

updated Nov 9, 2023

See the code

README

My solutions to Leetcode

I will put my solutions to Leetcode Problems in this repo. Every problem will be solved in C++; part of the problems will be solved in Java also. I will try my best to support more language in the future :)

Please feel free to contact me if you have any questions with this repo:)

email: [email protected]


大家好,欢迎大家来到我的 Leetcode 算法题解代码仓。在这个代码仓中,近乎每一个问题都会使用多种方式进行解决,同时标注了简明的算法思想,时间复杂度和空间复杂度。所有问题都会使用C++进行解决,各别问题支持Java语言和Python语言。

如果对代码仓有任何问题,欢迎联系我:)

电子邮件:[email protected]

知乎: 刘宇波 http://www.zhihu.com/people/liuyubobobo

知乎专栏:是不是很酷 https://zhuanlan.zhihu.com/liuyubobobo

个人公众号:是不是很酷:)

QRCode

知识星球(免费)

zsxq


其他相关代码仓

Problems

IDProblemOfficial
Solution
C++JavaPython
001Two SumsolutionC++Java
002Add Two NumberssolutionC++
003Longest Substring Without Repeating CharacterssolutionC++Java
004Median of Two Sorted ArrayssolutionC++Java
005Longest Palindromic SubstringsolutionC++
006Zigzag ConversionsolutionC++
007Reverse IntegersolutionC++
008String to Integer (atoi)solutionC++
010Regular Expression MatchingsolutionC++
011Container With Most WatersolutionC++
012Integer to Roman[无]C++
013Roman to Integer[无]C++
014Longest Common Prefix[无]C++
0153Sum[无]C++
0163Sum Closest[无]C++
017Letter Combinations of a Phone NumbersolutionC++Java
0184Sum[无]C++
019Remove Nth Node From End of ListsolutionC++Java
020Valid ParenthesessolutionC++Java
021Merge Two Sorted ListssolutionC++
022Generate ParenthesessolutionC++JavaPython
023Merge k Sorted ListssolutionC++
024Swap Nodes in Pairs[无]C++Java
025Reverse Nodes in k-Group[无]C++
026Remove Duplicates from Sorted ArraysolutionC++
027Remove ElementsolutionC++
028Implement strStr()[无]
[缺:完整BM算法, 其他模式匹配算法]
C++
029Divide Two Integerssolution
[缺:不使用乘法加法除法]
C++
030Substring with Concatenation of All WordssolutionC++
031Next PermutationsolutionC++
033Search in Rotated Sorted ArraysolutionC++
034Search for a RangesolutionC++
035Search Insert PositionsolutionC++
036Valid SudokusolutionC++
037Sudoku Solversolution
[缺:Dancing Links]
C++C++
038Count and Say[无]C++
039Combination Sum[无]C++
040Combination Sum II[无]C++
041First Missing PositivesolutionC++
042Trapping Rain WatersolutionC++
043Multiply StringssolutionC++
045Jump Game IIsolutionC++
046Permutationssolution
[缺:排列算法整理]
C++Java
047Permutations II[无]C++
048Rotate ImagesolutionC++
049Group AnagramssolutionC++
050Pow(x, n)[无]C++
051N-Queens[缺:N皇后问题整理]C++Java
052N-Queens IIsolution
[缺:N皇后问题整理]
C++
053Maximum SubarraysolutionC++
054Spiral MatrixsolutionC++
055Jump GamesolutionC++
056Merge IntervalssolutionC++
057Insert IntervalsolutionC++
058Length of Last WordsolutionC++
059Spiral Matrix II[无]C++
061Rotate ListsolutionC++
062Unique Paths[无]
[缺:数学解]
C++
063Unique Paths IIsolutionC++
064Minimum Path SumsolutionC++JavaPython
065Valid NumbersolutionC++
066Plus One[无]C++
067Add Binary[无]C++
068Text Justification[无]C++
069Sqrt(x)[无]C++
070Climbing StairssolutionC++Java
071Simplify Path[无]C++
072Edit DistancesolutionC++
073Set Matrix ZeroessolutionC++
074Search a 2D Matrix[无]C++
075Sort ColorssolutionC++JavaPython
076Minimum Window SubstringsolutionC++
077CombinationssolutionC++Java
078SubsetssolutionC++
079Word Search[无]C++Java
080Remove Duplicates from Sorted Array II[无]C++
081Search in Rotated Sorted Array IIsolutionC++
082Remove Duplicates from Sorted List II[无]C++
083Remove Duplicates from Sorted List[无]C++
084Largest Rectangle in Histogramsolution 题解C++
085Maximal RectanglesolutionC++
086Partition ListsolutionC++
087Scramble String[无]C++
088Merge Sorted ArraysolutionC++Java
089Gray Code[无]C++
090Subsets II[无]C++
091Decode Ways[无]C++
092Reverse Linked List IIsolutionC++
093Restore IP AddressessolutionC++
094Binary Tree Inorder TraversalsolutionC++Java
095Unique Binary Search Trees IIsolutionC++
096Unique Binary Search TreessolutionC++
097Interleaving Stringsolution
[缺:DP]
C++
098Validate Binary Search TreesolutionC++Java
099Recover Binary Search Tree[无]Java
100Same TreesolutionC++
101Symmetric TreesolutionC++Python
102Binary Tree Level Order TraversalsolutionC++Java
103Binary Tree Zigzag Level Order Traversal[无]C++
104Maximum Depth of Binary TreesolutionC++Java
105Construct Binary Tree from Preorder and Inorder TraversalsolutionC++
106Construct Binary Tree from Inorder and Postorder Traversal[无]C++
107Binary Tree Level Order Traversal II[无]C++
108Convert Sorted Array to Binary Search Tree[无]C++
109Convert Sorted List to Binary Search TreesolutionC++
110Balanced Binary TreesolutionC++
111Minimum Depth of Binary TreesolutionC++
112Path SumsolutionC++Java
113Path Sum II[无]C++
114Flatten Binary Tree to Linked ListsolutionC++
115Distinct Subsequences[无]C++Java
116Populating Next Right Pointers in Each Node[无]C++
117Populating Next Right Pointers in Each Node II[无]C++
118Pascal's TrianglesolutionC++
119Pascal's Triangle II[无]C++
120Triangle[无]C++
121Best Time to Buy and Sell StockC++
122Best Time to Buy and Sell Stock IIsolutionC++
123Best Time to Buy and Sell Stock IIIC++
124Binary Tree Maximum Path SumsolutionC++
125Valid Palindrome[无]C++
126Word Ladder II[无]
[缺:双端搜索]
C++
127Word LaddersolutionC++Java
128Longest Consecutive SequenceC++
129Sum Root to Leaf Numbers[无]C++
130Surrounded Regions[无]C++
131Palindrome Partitioningsolution
[缺:DP]
C++
132Palindrome Partitioning II[无]C++
133Clone Graph[无]C++
134Gas StationsolutionC++
135Candysolution
[缺:O(1)空间算法]
C++
136Single NumbersolutionC++
137Single Number IIsolutionC++
138Copy List with Random PointersolutionC++
139Word BreaksolutionC++
141Linked List CyclesolutionC++
142Linked List Cycle IIsolutionC++
143Reorder List[无]C++
144Binary Tree Preorder TraversalsolutionC++Java
145Binary Tree Postorder TraversalsolutionC++Java
146LRU Cachesolution
[缺:封装一个Double Linked List]
C++
147Insertion Sort List[无]C++
148Sort List[无]C++
149Max Points on a LinesolutionC++
150Evaluate Reverse Polish Notation[无]C++
151Reverse Words in a String[无]C++
152Maximum Product Subarraysolution
[缺:Linear]
C++Python
153Find Minimum in Rotated Sorted ArraysolutionC++
155Min Stack[无]C++
159Longest Substring with At Most Two Distinct CharacterssolutionC++
160Intersection of Two Linked ListssolutionC++
161One Edit DistancesolutionC++
162Find Peak ElementsolutionC++
163Missing RangessolutionC++
164Maximum Gapsolution
[缺:桶排序]
C++
165Compare Version NumberssolutionC++
166Fraction to Recurring DecimalsolutionC++
167Two Sum II - Input array is sortedsolutionC++Java
168Excel Sheet Column Title[无]C++
169Majority ElementsolutionC++Python
170Two Sum III - Data structure design[无]C++
171Excel Sheet Column Number[无]C++
172Factorial Trailing ZeroessolutionC++
173Binary Search Tree Iterator[无]
[缺:Morris遍历]
C++
174Dungeon GamesolutionC++
175Database Problem: Link----
176Database Problem: Link----
179Largest Number[无]C++
181Database Problem: Link----
184Database Problem: Link----
186Reverse Words in a String II[无]C++
188Best-Time-to-Buy-and-Sell-Stock-IVC++
189Rotate ArraysolutionC++
190Reverse BitssolutionC++
191Number of 1 BitssolutionC++
196Database Problem: Link----
197Database Problem: Link----
198House RobbersolutionC++Java
199Binary Tree Right Side ViewsolutionC++
200Number of IslandssolutionC++Java
201Bitwise AND of Numbers RangesolutionC++
202Happy NumbersolutionC++
203Remove Linked List Elements[无]C++Java
204Count Primes[无]C++
205Isomorphic Strings[无]C++
206Reverse Linked ListsolutionC++Java
207Course Schedule[无]C++
208Implement Trie (Prefix Tree)solutionC++
209Minimum Size Subarray SumsolutionC++Java
210Course Schedule IIsolutionC++
211Add and Search Word - Data structure design[无]C++Java
212Word Search II[无]C++
213House Robber II[无]C++
215Kth Largest Element in an ArraysolutionC++
216Combination Sum III[无]C++
217Contains Duplicate[无]C++
218The Skyline ProblemC++
219Contains Duplicate IIsolutionC++Java
220Contains Duplicate IIIsolutionC++Java
221Maximal SquaresolutionC++Python
222Count Complete Tree Nodes[无]C++
223Rectangle Area[无]C++
224Basic Calculator[无]C++
225Implement Stack using QueuessolutionC++
226Invert Binary TreesolutionC++JavaPython
227Basic Calculator II[无]C++
228Summary RangessolutionC++
229Majority Element IIsolution
[缺:BM Voting]
C++
230Kth Smallest Element in a BSTsolution
[缺:非递归]
C++
231Power of TwosolutionC++
232Implement Queue using StackssolutionC++
233Number of Digit Onesolution
[缺:数学方法]
C++
234Palindrome Linked List[无]C++
235Lowest Common Ancestor of a Binary Search TreesolutionC++Java
236Lowest Common Ancestor of a Binary Treesolution
[缺:非递归解法;LCA问题总结]
C++
237Delete Node in a Linked ListsolutionC++Java
238Product of Array Except SelfsolutionC++Python
239Sliding Window MaximumsolutionC++
240Search a 2D Matrix IIsolution
[缺:分治]
C++
241Different Ways to Add Parentheses[无]C++
242Valid AnagramsolutionC++
243Shortest Word DistancesolutionC++
244Shortest Word Distance IIsolutionC++
245Shortest Word Distance III[无]C++
246Strobogrammatic NumbersolutionC++
247Strobogrammatic Number II[无]C++
248Strobogrammatic Number III[无]C++
249Group Shifted Strings[无]C++
250Count Univalue SubtreessolutionC++
251Flatten 2D VectorsolutionC++
252Meeting RoomssolutionC++
253Meeting Rooms IIsolutionC++
254Factor Combinations[无]C++
256Paint House[无]C++
257Binary Tree PathssolutionC++Java
258Add DigitssolutionC++
2593Sum SmallersolutionC++
260Single Number IIIsolutionC++
261Graph Valid TreeC++
263Ugly Number[无]C++
264Ugly Number IIsolutionC++
265Paint House IIC++
266Palindrome PermutationsolutionC++
267Palindrome Permutation IIsolutionC++
268Missing NumbersolutionC++
269Alien DictionarysolutionC++
273Integer to English WordssolutionC++
274H-Indexsolution
[缺:非二分]
C++
275H-Index IIsolutionC++
276Paint FencesolutionC++
277Find the Celebritysolution
[缺:O(n) 解法]
C++
278First Bad VersionsolutionC++
279Perfect Squares[无]
四平方和数学解
C++Java
280Wiggle SortsolutionC++
282Expression Add OperatorssolutionC++
283Move ZeroessolutionC++Java
284Peeking IteratorsolutionC++
285Inorder Successor in BST[无]
[缺:空间O(h)]
C++
286Walls and GatessolutionC++
287Find the Duplicate NumberC++
288Unique Word AbbreviationsolutionC++
289Game of LifesolutionC++
290Word Pattern[无]C++
292Nim GamesolutionC++
295Find Median from Data Stream[无]C++
296Best Meeting PointsolutionC++
297Serialize and Deserialize Binary TreesolutionC++
298Binary Tree Longest Consecutive SequencesolutionC++
299Bulls and CowssolutionC++
300Longest Increasing SubsequencesolutionC++Java
3010301-Remove-Invalid-Parenthesessolution
[缺:DP+构建]
C++
303Range Sum Query - ImmutableC++
304Range Sum Query 2D - ImmutablesolutionC++
305Number of Islands IIsolutionC++
306Additive Number[无]C++
307Range Sum Query - Mutable[缺:BIT]C++
308Range Sum Query 2D - MutableC++
309Best Time to Buy and Sell Stock with CooldownsolutionC++
310Minimum Height TreessolutionC++
311Sparse Matrix Multiplication[无]C++
312Burst Balloonssolution 题解C++
313Super Ugly Number[无]C++
314Binary Tree Vertical Order Traversal[无]C++
315Count of Smaller Numbers After Self[无]C++
316Remove Duplicate LetterssolutionC++
317Shortest Distance from All BuildingssolutionC++
318Maximum Product of Word LengthssolutionC++
319Bulb Switcher[无]C++
321Create Maximum Number[无]C++
322Coin ChangesolutionC++
323Number of Connected Components in an Undirected GraphsolutionC++
324Wiggle Sort II[无]C++
325Maximum Size Subarray Sum Equals ksolutionC++
326Power of ThreesolutionC++
328Odd Even Linked ListsolutionC++
329Longest Increasing Path in a MatrixsolutionC++
330Patching Array[无]C++
331Verify Preorder Serialization of a Binary TreesolutionC++
332Reconstruct ItinerarysolutionC++
334Increasing Triplet SubsequencesolutionC++
335Self Crossing[无]C++
336Palindrome PairssolutionC++
337House Robber III[无]C++
338Counting BitssolutionC++
339Nested List Weight Sum[无]C++
340Longest Substring with At Most K Distinct CharacterssolutionC++
341Flatten Nested List Iterator[无]C++
342Power of FoursolutionC++
343Integer Break[无]C++Java
344Reverse String[无]C++
345Reverse Vowels of a String[无]C++
346Moving Average from Data Stream[无]C++
347Top K Frequent ElementssolutionC++Java
348Find Winner on a Tic Tac Toe Game[无]C++
349Intersection of Two ArrayssolutionC++Java
350Intersection of Two Arrays II[无]C++Java
352Data Stream as Disjoint Intervals[无]C++
354Russian Doll EnvelopessolutionC++
357Count Numbers with Unique Digits[无]C++
359Logger Rate Limiter[无]C++
360Sort Transformed Array[无]C++
362Design Hit Counter[无]C++
363Max Sum of Rectangle No Larger Than K[无]C++
364Nested List Weight Sum II[无]C++
365Water and Jug Problem题解
[缺:数学解法]
C++
366Find Leaves of Binary TreesolutionC++
367Valid Perfect SquaresolutionC++
368Largest Divisible SubsetsolutionC++
369Plus One Linked ListsolutionC++
370Range AdditionC++
372Super Pow[无]C++
373Find K Pairs with Smallest Sums[无]C++
374Guess Number Higher or LowersolutionC++
375Guess Number Higher or Lower II[无]C++
376Wiggle SubsequencesolutionC++
[缺:DP;O(1) 空间贪心]
377Combination Sum IV[无]C++
378Kth Smallest Element in a Sorted Matrix[无]C++
380Insert Delete GetRandom O(1)[无]C++
381Insert Delete GetRandom O(1) - Duplicates allowed[无]C++
382Linked List Random Node[无]C++
383Ransom NotesolutionC++
384Shuffle an ArraysolutionC++
385Mini Parser[无]C++
386Lexicographical NumbersC++
387First Unique Character in a StringsolutionC++Java
388Longest Absolute File PathC++
389Find the DifferenceC++
390Elimination GameC++
391Perfect Rectangle[缺:矩形求交]C++
392Is Subsequence[无]C++
393UTF-8 ValidationsolutionC++
394Decode String[无]C++
395Longest Substring with At Least K Repeating Characterssolution
[缺:滑动窗口]
C++
396Rotate Function[无]C++
397Integer Replacement[无]C++
398Random Pick Index[无]C++
399Evaluate Divisionsolution
[缺:UF]
C++
400Nth Digit[无]C++
401Binary Watch[无]C++
402Remove K Digitssolution 题解C++
403Frog Jumpsolution
[缺:dp]
C++
404Sum of Left Leaves[无]C++
405Convert a Number to Hexadecimal[无]C++
406Queue Reconstruction by Height[无]C++
407Trapping Rain Water II[无]C++
410Split Array Largest Sumsolution 题解C++
412Fizz BuzzsolutionC++
413Arithmetic SlicessolutionC++
414Third Maximum Number[无]C++
415Add StringssolutionC++
416Partition Equal Subset Sum[无]C++Java
417Pacific Atlantic Water FlowC++Java
419Battleships in a Board[无]C++
420Strong Password Checker[无]C++
421Maximum XOR of Two Numbers in an ArraysolutionC++
422Valid Word Square[无]C++
423Reconstruct Original Digits from EnglishsolutionC++
424Longest Repeating Character Replacement[无]C++
426Convert Binary Search Tree to Sorted Doubly Linked ListsolutionC++
427Construct Quad Tree[无]C++
429N-ary Tree Level Order Traversal[无]C++
430Flatten a Multilevel Doubly Linked List[无]C++
431Encode N-ary Tree to Binary TreesolutionC++
432All O one Data Structure[无] [缺:O(1)]C++
433Minimum Genetic Mutation[无]C++
434Number of Segments in a String[无]C++
435Non-overlapping IntervalssolutionC++Java
436Find Right Interval[无]C++
437Path Sum III[无]C++Java
438Find All Anagrams in a String[无]C++
439Ternary Expression Parser[无]C++
440K-th Smallest in Lexicographical Order[无] [缺:更简单的实现]C++
441Arranging CoinssolutionC++
442Find All Duplicates in an ArraysolutionC++
443String CompressionC++
444Sequence Reconstruction[无]C++
445Add Two Numbers II[无]C++
446Arithmetic Slices II - SubsequencesolutionC++
447Number of Boomerangs[无]C++Java
448Find All Numbers Disappeared in an ArraysolutionC++
449Serialize and Deserialize BSTsolutionC++
450Delete Node in a BSTsolutionC++
451Sort Characters By Frequency[无]C++Java
452Minimum Number of Arrows to Burst BalloonssolutionC++
453Minimum Moves to Equal Array ElementssolutionC++
4544Sum II[无]C++Java
455Assign Cookies[无]C++Java
456132 Patternsolution
[缺:O(n) 单调栈算法]
C++
457Circular Array Loop[无]C++
458Poor PigssolutionC++
459Repeated Substring Pattern[无]C++
460LFU CachesolutionC++
461Hamming DistancesolutionC++
462Minimum Moves to Equal Array Elements IIsolutionC++
463Island PerimetersolutionC++
464Can I Win[无]C++
467Unique Substrings in Wraparound String[无]C++
468Validate IP Address[无]C++
470Implement Rand10() Using Rand7()solutionC++
472Concatenated Words[无]C++
473Matchsticks to SquaresolutionC++
474Ones and ZeroessolutionC++
475Heaters[无]C++
476Number ComplementsolutionC++
477Total Hamming Distancesolution 题解C++
478Generate Random Point in a CirclesolutionC++
479Largest Palindrome Product[无]C++
480Sliding Window Median[无]
[缺:双数据结构]
C++
481Magical String[无]C++
482License Key Formatting[无]C++
483Smallest Good Base[无]C++
484Find PermutationsolutionC++
485Max Consecutive Ones[无]C++
486Predict the Winner[无]C++
487Max Consecutive Ones II[无]C++
488Zuma Game[无]C++
489Robot Room CleanersolutionC++
490The MazesolutionC++
491Non-decreasing Subsequences[无]C++
492Construct the Rectangle[无]C++
494Target SumsolutionC++
495Teemo AttackingsolutionC++
496Next Greater Element IsolutionC++
497Random Point in Non-overlapping RectanglessolutionC++
498Diagonal Traverse[无]C++
500Keyboard Row[无]C++
501Find Mode in Binary Search Tree[无]C++
502IPOsolutionC++
503Next Greater Element IIsolutionC++
504Base 7[无]C++
505The Maze IIsolutionC++
506Relative Ranks[无]C++
507Perfect NumbersolutionC++
508Most Frequent Subtree Sum[无]C++
509Fibonacci Number[无]C++
510Inorder Successor in BST II[无]C++
511Database Problem: Link----
513Find Bottom Left Tree Value[无]C++
515Find Largest Value in Each Tree Row[无]C++
516Longest Palindromic Subsequence[无]C++
517Super Washing MachinessolutionC++
518Coin Change 2[无]C++
519Random Flip MatrixsolutionC++
520Detect CapitalsolutionC++
521Longest Uncommon Subsequence IsolutionC++
522Longest Uncommon Subsequence IIsolutionC++
523Continuous Subarray Sum[无]C++
524Longest Word in Dictionary through DeletingsolutionC++
525Contiguous Arraysolution 题解C++
526Beautiful ArrangementsolutionC++
527Word AbbreviationsolutionC++
528Random Pick with WeightsolutionC++
529Minesweeper[无]C++
530Minimum Absolute Difference in BST[无]Java
531Lonely Pixel I[无]C++
532K-diff Pairs in an ArraysolutionC++
533Lonely Pixel II[无]C++
536Construct Binary Tree from Stringsolution
[缺:stack]
C++
537Complex Number MultiplicationsolutionC++
538Convert BST to Greater TreesolutionC++
539Minimum Time Difference[无]C++
540Single Element in a Sorted ArraysolutionC++
541Reverse String IIsolutionC++
54201 MatrixsolutionC++
543Diameter of Binary TreesolutionC++
546Remove BoxessolutionC++
547Number of ProvincessolutionC++
549Binary Tree Longest Consecutive Sequence IIsolutionC++
551Student Attendance Record IsolutionC++
552Student Attendance Record IIsolutionC++
553Optimal Divisionsolution
[缺:O(n) 解法]
C++
554Brick WallsolutionC++
556Next Greater Element IIIsolution
[缺:底层实现]
C++
557Reverse Words in a String IIIsolutionC++
558Logical OR of Two Binary Grids Represented as Quad-Trees[无]C++
559Maximum Depth of N-ary TreesolutionC++
560Subarray Sum Equals KsolutionC++
561Array Partition IsolutionC++
563Binary Tree TiltsolutionC++
564Find the Closest Palindrome[无]C++
565Array NestingsolutionC++
566Reshape the MatrixsolutionC++
567Permutation in Stringsolution 题解C++
570Database Problem: Link----
572Subtree of Another TreesolutionC++
573Squirrel SimulationsolutionC++
575Distribute CandiessolutionC++
576Out of Boundary PathssolutionC++
580Database Problem: Link----
581Shortest Unsorted Continuous Subarraysolution
[缺:Stack]
C++
582Kill ProcesssolutionC++
583Delete Operation for Two StringssolutionC++
584Database Problem: Link----
586Database Problem: Link----
587Erect the Fencesolution 题解
[缺:凸包解法整理]
C++
589N-ary Tree Preorder TraversalsolutionC++
590N-ary Tree Postorder TransversalsolutionC++
591Tag ValidatorsolutionC++
592Fraction Addition and Subtraction[无]C++
593Valid SquaresolutionC++
594Longest Harmonious SubsequencesolutionC++
595Database Problem: Link----
598Range Addition IIC++
599Minimum Index Sum of Two ListssolutionC++
600Non-negative Integers without Consecutive Onessolution
[缺:Bit Manipulation]
C++
605Can Place FlowerssolutionC++
606Construct String from Binary TreesolutionC++
607Database Problem: Link----
608Database Problem: Link----
609Find Duplicate File in SystemsolutionC++
611Valid Triangle NumbersolutionC++
617Merge Two Binary TreesC++
619Database Problem: Link----
621Task SchedulersolutionC++
622Design Circular Queue[无]C++
623Add One Row to TreesolutionC++
627Database Problem: Link----
628Maximum Product of Three NumberssolutionC++
629K-Inverse-Pairs-Arraysolution
[缺:其他 dp 优化思路]
C++
630Course Schedule IIIsolutionC++
632Smallest Range Covering Elements from K ListssolutionC++
633Sum of Square NumbersC++
636Exclusive Time of Functions[无]C++
637Average of Levels in Binary TreesolutionC++
638Shopping OfferssolutionC++
639Decode Ways IIsolution
[缺:DP]
C++
640Solve the Equation[无]C++
642Design Search Autocomplete System[无]C++
643Maximum Average Subarray IsolutionC++
644Maximum Average Subarray IIsolutionC++
645Set Mismatchsolution
[缺:空间 O(1) 解法]
C++
646Maximum Length of Pair ChainsolutionC++
647Palindromic SubstringssolutionC++
648Replace Words[无]C++
649Dota2 Senatesolution
[缺:队列]
C++
6502 Keys KeyboardsolutionC++
652Find Duplicate SubtreessolutionC++
653Two Sum IV - Input is a BST[无]C++
654Maximum Binary TreesolutionC++
655Print Binary Tree[无]C++
658Find K Closest Elementssolution
[缺:二分]
C++
659Split Array into Consecutive SubsequencessolutionC++
661Image Smoother[无]C++
662Maximum Width of Binary TreesolutionC++
664Strange PrintersolutionC++
665Non-decreasing ArraysolutionC++
666Path Sum IVsolutionC++
667Beautiful Arrangement IIsolutionC++
668Kth Smallest Number in Multiplication TablesolutionC++
669Trim a Binary Search TreesolutionC++
670Maximum Swap[无]C++
671Second Minimum Node In a Binary TreesolutionC++
672Bulb Switcher IIsolutionC++
673Number of Longest Increasing Subsequence[缺:BIT;线段树]C++
674Longest Continuous Increasing SubsequenceC++
675Cut Off Trees for Golf Event[缺:A*;Hadlock's Algo]C++
676Implement Magic DictionarysolutionC++
677Map Sum PairssolutionC++
678Valid Parenthesis StringsolutionC++
67924 GamesolutionC++
680Valid Palindrome II[无]C++
682Baseball GamesolutionC++
684Redundant ConnectionsolutionC++
685Redundant Connection IIsolutionC++
686Repeated String Match[无]C++
687Longest Univalue PathsolutionC++
688Knight Probability in ChessboardsolutionC++
689Maximum Sum of 3 Non-Overlapping SubarrayssolutionC++
690Employee ImportancesolutionC++
691Stickers to Spell Word[无]C++
692Top K Frequent WordssolutionC++
693Binary Number with Alternating Bits[无]C++
694Number of Distinct Islands[review: hash的方式]C++
695Max-Area-of-IslandC++
696Count Binary SubstringsC++
697Degree of an ArrayC++
698Partition to K Equal Sum SubsetsC++Java
699Falling Squares[缺:线段树;块状链表]C++
700Search in a Binary Search TreesolutionC++
701Insert into a Binary Search TreesolutionC++
703Kth Largest Element in a Stream[无]C++
704Binary SearchsolutionC++
705Design HashSet[无]C++
706Design HashMap[无]C++
707Design Linked List[无]C++
708Insert into a Cyclic Sorted List[无]C++
709To Lower CasesolutionC++
710Random Pick with BlacklistsolutionC++
711Number of Distinct Islands II[review: hash的方式]C++
712Minimum ASCII Delete Sum for Two StringsC++
713Subarray Product Less Than KC++
714Best Time to Buy and Sell Stock with Transaction FeeC++
715Range Module[缺:set查找]C++
716Max StacksolutionC++
7171-bit and 2-bit CharactersC++
718Maximum Length of Repeated Subarray[缺:Rolling Hash]C++
719Find K-th Smallest Pair DistancesolutionC++
720Longest Word in DictionarysolutionC++
721Accounts MergesolutionC++
722Remove CommentssolutionC++
723Candy CrushsolutionC++
724Find Pivot IndexsolutionC++
725Split Linked List in PartssolutionC++
726Number of AtomssolutionC++
727Minimum Window SubsequencesolutionC++
728Self Dividing NumberssolutionC++
729My Calendar IsolutionC++
730Count Different Palindromic Subsequences[无]C++
731My Calendar IIsolutionC++
732My Calendar IIIsolutionC++
733Flood FillsolutionC++
734Sentence SimilaritysolutionC++
735Asteroid CollisionsolutionC++
736Parse Lisp ExpressionsolutionC++
737Sentence Similarity IIsolutionC++
739Daily TemperaturessolutionC++
740Delete and EarnsolutionC++
741Cherry Pickupsolution
[缺:自底向上的动态规划]
C++
745Prefix and Suffix SearchsolutionC++
746Min Cost Climbing StairssolutionC++
747Largest Number At Least Twice of OtherssolutionC++
749Contain Virus[无]C++
752Open the LocksolutionC++
753Cracking the Safe[无]C++
754Reach a NumberSolutionC++
757Set Intersection Size At Least Two[无]C++
761Special Binary StringsolutionC++
762Prime Number of Set Bits in Binary Representation[无]C++
763Partition Labels[无]C++
764Largest Plus SignC++
765Couples Holding HandssolutionC++
766Toeplitz MatrixsolutionC++
771Jewels and StonessolutionC++
772Basic Calculator III[无]C++
774Minimize Max Distance to Gas StationsolutionC++
775Global and Local InversionsC++
779K-th Symbol in Grammar[无]C++
780Reaching PointssolutionC++
781Rabbits in ForestsolutionC++
782Transform to ChessboardsolutionC++
783Minimum Distance Between BST NodessolutionC++
784Letter Case PermutationsolutionC++
785Is Graph Bipartite?solutionC++
786K-th Smallest Prime Fractionsolution
[缺:分治算法]
C++
787Cheapest Flights Within K Stopssolution
[缺:使用Heap]
C++
788Rotated DigitssolutionC++
789Escape The GhostssolutionC++
790Domino and Tromino Tilingsolution
[缺:转移矩阵求幂解法]
C++
791Custom Sort StringsolutionC++
792Number of Matching SubsequencessolutionC++
793Preimage Size of Factorial Zeroes FunctionsolutionC++
794Valid Tic-Tac-Toe StatesolutionC++
795Number of Subarrays with Bounded MaximumsolutionC++
796Rotate Stringsolution
[缺:Rolling Hash]
C++
797All Paths From Source to TargetsolutionC++
798Smallest Rotation with Highest Scoresolution
[缺:O(n) 解法]
C++
799Champagne TowersolutionC++
800Similar RGB ColorsolutionC++
802Find Eventual Safe StatessolutionC++
803Bricks Falling When Hit[无]C++
804Unique Morse Code WordssolutionC++
805Split Array With Same AveragesolutionC++
806Number of Lines To Write StringsolutionC++
807Max Increase to Keep City SkylinesolutionC++
809Expressive WordssolutionC++
810Chalkboard XOR GamesolutionC++
811Subdomain Visit CountsolutionC++
813Largest Sum of AveragessolutionC++
814Binary Tree PruningsolutionC++
815Bus RoutessolutionC++
817Linked List ComponentssolutionC++
819Most Common WordsolutionC++
822Card Flipping Game[无]C++
823Binary Trees With FactorssolutionC++
824Goat Latin[无]C++
825Friends Of Appropriate Ages[无]C++
827Making A Large Island[无]C++
828Count Unique Characters of All Substrings of a Given String[无]C++
829Consecutive Numbers Sum[无]C++
830Positions of Large GroupssolutionC++
831Masking Personal Information[无]C++
832Flipping an ImagesolutionC++
833Find And Replace in String[无]C++
834Sum of Distances in TreesolutionC++
835Image Overlap[无]C++
837New 21 Game[无]C++
838Push DominoessolutionC++
839Similar String Groupssolution
C++
841Keys and RoomssolutionC++
842Split Array into Fibonacci SequencesolutionC++
844Backspace String ComparesolutionC++
846Hand of Straights[无]C++
847Shortest Path Visiting All Nodes[无]C++
848Shifting Letters[无]C++
849Maximize Distance to Closest Person[无]C++
850Rectangle Area IIsolutionC++
851Loud and RichsolutionC++
852Peak Index in a Mountain ArraysolutionC++
853Car FleetsolutionC++
854K-Similar StringssolutionC++
855Exam RoomsolutionC++
856Score of ParenthesessolutionC++
857Minimum Cost to Hire K Workerssolution
[缺:二分搜索]
C++
858Mirror ReflectionsolutionC++
859Buddy StringssolutionC++
860Lemonade ChangesolutionC++
861Score After Flipping MatrixsolutionC++
863All Nodes Distance K in Binary TreesolutionC++
864Shortest Path to Get All Keyssolution
[缺:Dijkstra]
C++
865Smallest Subtree with all the Deepest NodessolutionC++
866Prime PalindromesolutionC++
867Transpose MatrixsolutionC++
868Binary GapsolutionC++
869Reordered Power of 2solutionC++
870Advantage ShufflesolutionC++
871Minimum Number of Refueling Stopssolution 题解C++
872Leaf-Similar TreessolutionC++
873Length of Longest Fibonacci SubsequencesolutionC++
874Walking-Robot-SimulationsolutionC++
875Koko Eating BananassolutionC++
876Middle of the Linked ListsolutionC++
877Stone GamesolutionC++
878Nth Magical NumbersolutionC++
879Profitable SchemessolutionC++
880Decoded String at IndexsolutionC++
881Boats to Save PeoplesolutionC++
882Reachable Nodes In Subdivided GraphsolutionC++
883Projection Area of 3D ShapessolutionC++
884Uncommon Words from Two SentencessolutionC++
885Spiral Matrix IIIsolutionC++
886Possible BipartitionsolutionC++
888Fair Candy SwapsolutionC++
889Construct Binary Tree from Preorder and Postorder TraversalsolutionC++
890Find and Replace PatternsolutionC++
891Sum of Subsequence WidthssolutionC++
892Surface Area of 3D ShapessolutionC++
893Groups of Special-Equivalent StringssolutionC++
894All Possible Full Binary TreessolutionC++
895Maximum Frequency StacksolutionC++
896Monotonic ArraysolutionC++Python
897Increasing Order Search TreesolutionC++
898Bitwise ORs of SubarrayssolutionC++
899Orderly QueuesolutionC++
900RLE IteratorsolutionC++
901Online Stock SpansolutionC++
902Numbers At Most N Given Digit SetsolutionC++
903Valid Permutations for DI Sequencesolution
[缺:O(n^2) DP]
C++
904Fruit Into BasketssolutionC++
905Sort Array By ParitysolutionC++
906Super PalindromessolutionC++
907Sum of Subarray MinimumssolutionC++
908Smallest Range IsolutionC++
909Snakes and LadderssolutionC++
910Smallest Range IIsolutionC++
911Online ElectionsolutionC++
912Sort an Array[无]C++
913Cat and Mouse Gamesolution
[缺:DFS拓扑排序;DP]
C++
914X of a Kind in a Deck of CardssolutionC++
915Partition Array into Disjoint IntervalssolutionC++
916Word SubsetssolutionC++
917Reverse Only LetterssolutionC++
918Maximum Sum Circular SubarraysolutionC++
919Complete Binary Tree InsertersolutionC++
920Number of Music Playlistssolution
[缺:生成函数]
C++
921Minimum Add to Make Parentheses ValidsolutionC++
922Sort Array By Parity IIsolutionC++
9233Sum With MultiplicitysolutionC++
924Minimize Malware SpreadsolutionC++
925Long Pressed NamesolutionC++
926Flip String to Monotone IncreasingsolutionC++
927Three Equal PartssolutionC++
928Minimize Malware Spread IIsolutionC++
929Unique Email AddressessolutionC++
930Binary Subarrays With SumsolutionC++
931Minimum Path Falling SumsolutionC++
932Beautiful ArraysolutionC++
933Number of Recent CallssolutionC++
934Shortest BridgesolutionC++
935Knight DialersolutionC++
936Stamping The SequencesolutionC++
937Reorder Log FilessolutionC++
938Range Sum of BSTsolutionC++
939Minimum Area RectanglesolutionC++
940Distinct Subsequences IIsolutionC++
941Valid Mountain ArraysolutionC++
942DI String MatchsolutionC++
943Find the Shortest Superstringsolution
[缺:动态规划]
C++
944Delete Columns to Make SortedsolutionC++
945Minimum Increment to Make Array UniquesolutionC++
946Validate Stack SequencessolutionC++
947Most Stones Removed with Same Row or ColumnsolutionC++
948Bag of TokenssolutionC++
949Largest Time for Given DigitssolutionC++
950Reveal Cards In Increasing OrdersolutionC++
951Flip Equivalent Binary TreessolutionC++
952Largest Component Size by Common FactorsolutionC++
953isAlienSortedsolutionC++
954Array of Doubled PairssolutionC++
955Delete Columns to Make Sorted IIsolutionC++
956Tallest BillboardsolutionC++
957Prison Cells After N DayssolutionC++
958Check Completeness of a Binary TreesolutionC++
959Regions Cut By SlashessolutionC++
960Delete Columns to Make Sorted IIIsolutionC++
961N-Repeated Element in Size 2N ArraysolutionC++
965Univalued Binary TreesolutionC++
966Vowel SpellcheckersolutionC++
967Numbers With Same Consecutive DifferencessolutionC++
968Binary Tree CamerassolutionC++
969Pancake SortingsolutionC++
970Powerful IntegerssolutionC++
971Flip Binary Tree To Match Preorder TraversalsolutionC++
972Equal Rational NumberssolutionC++
973K Closest Points to OriginsolutionC++
974Subarray Sums Divisible by KsolutionC++
975Odd Even JumpsolutionC++
976Largest Perimeter TrianglesolutionC++
977Squares of a Sorted ArraysolutionC++
978Longest Turbulent Subarraysolution
[缺:滑动窗口 & dp]
C++
979Distribute Coins in Binary TreesolutionC++
980Unique Paths IIIsolution
[缺:记忆化搜索]
C++Java
981Time Based Key-Value StoresolutionC++
982Triples with Bitwise AND Equal To Zero[无]C++
983Minimum Cost For TicketssolutionC++
984String Without AAA or BBBsolutionC++
985Sum of Even Numbers After QueriessolutionC++
986Interval List IntersectionssolutionC++
987Vertical Order Traversal of a Binary TreesolutionC++
988Smallest String Starting From LeafsolutionC++
989Add to Array-Form of IntegersolutionC++
990Satisfiability of Equality EquationssolutionC++
991Broken CalculatorsolutionC++
992Subarrays with K Different IntegerssolutionC++
993Cousins in Binary TreesolutionC++
994Rotting OrangessolutionC++
995Minimum Number of K Consecutive Bit FlipssolutionC++
996Number of Squareful ArrayssolutionC++
997Find the Town Judge[无]C++
998Maximum Binary Tree II[无]C++
999Available Captures for Rook[无]C++
1000Minimum Cost to Merge Stones[无]C++
1001Grid Illumination[无]C++
1002Find Common Characters[无]C++
1003Check If Word Is Valid After Substitutions[无]C++
1004Max Consecutive Ones III[无]C++
1005Maximize Sum Of Array After K Negations[无]C++
1006Clumsy Factorial[无]C++
1007Minimum Domino Rotations For Equal Row[无]C++
1008Construct Binary Search Tree from Preorder Traversal[无]C++
1009Complement of Base 10 Integer[无]C++
1010Pairs of Songs With Total Durations Divisible by 60[无]C++
1011Capacity To Ship Packages Within D Days[无]C++
1012Numbers With 1 Repeated Digit[无]C++
1013Partition Array Into Three Parts With Equal Sum[无]C++
1014Best Sightseeing Pair[无]C++
1015Smallest Integer Divisible by K[无]C++
1016Binary String With Substrings Representing 1 To N[无]C++
1017Convert to Base -2[无]C++
1018Binary Prefix Divisible By 5[无]C++
1019Next Greater Node In Linked List[无]C++
1020Number of Enclaves[无]C++
1021Remove Outermost Parentheses[无]C++
1022Sum of Root To Leaf Binary Numbers[无]C++
1023Camelcase Matching[无]C++
1024Video Stitching[无]C++
1025Divisor Game[无]C++
1026Maximum Difference Between Node and Ancestor[无]C++
1027Longest Arithmetic Sequence[无]C++
1028Recover a Tree From Preorder Traversal[无]C++
1029Two City Scheduling[无]C++
1030Matrix Cells in Distance Order[无]C++
1031Maximum Sum of Two Non-Overlapping Subarrays[无]C++
1032Stream of Characters[无]C++
1033Moving Stones Until Consecutive[无]C++
1034Coloring A Border[无]C++
1035Uncrossed Lines[无]C++
1036Escape a Large Maze[无]C++
1037Valid Boomerang[无]C++
1038Binary Search Tree to Greater Sum Tree[无]C++
1039Minimum Score Triangulation of Polygon[无]C++
1040Moving Stones Until Consecutive II[无]C++
1041Robot Bounded In Circle[无]C++
1042Flower Planting With No Adjacent[无]C++
1043Partition Array for Maximum Sum[无]C++
1044Longest Duplicate Substring[无]
[缺:后缀数组]
C++
1046Last Stone Weight[无]C++
1047Remove All Adjacent Duplicates In String[无]C++
1049Last Stone Weight II[无]C++
1050Database Problem: Link----
1051Height Checker[无]C++
1052Grumpy Bookstore Owner[无]C++
1053Previous Permutation With One Swap[无]C++
1054Distant Barcodes[无]C++
1055Shortest Way to Form String[无]C++
1056Confusing Number[无]C++
1059All Paths from Source Lead to DestinationsolutionC++
1061Lexicographically Smallest Equivalent String[无]C++
1062Longest Repeating Substring[无]C++
1065Index Pairs of a String[无][C++](1001-1500/106

Truncated — view the full README on GitHub.

algorithm-challenges
algorithm-competitions
algorithms
interview-questions
leetcode-cpp
leetcode-solutions

liuyubobobo/Play-Leetcode

My Solutions to Leetcode problems. All solutions support C++ language, some support Java and Python. Multiple solutions will be given by most problems. Enjoy:) 我的Leetcode解答。所有的问题都支持C++语言,一部分问题支持Java语言。近乎所有问题都会提供多个算法解决。大家加油!:)

C++

2,720

2,588 commits

updated Nov 9, 2023

See the code

README

My solutions to Leetcode

I will put my solutions to Leetcode Problems in this repo. Every problem will be solved in C++; part of the problems will be solved in Java also. I will try my best to support more language in the future :)

Please feel free to contact me if you have any questions with this repo:)

email: [email protected]


大家好,欢迎大家来到我的 Leetcode 算法题解代码仓。在这个代码仓中,近乎每一个问题都会使用多种方式进行解决,同时标注了简明的算法思想,时间复杂度和空间复杂度。所有问题都会使用C++进行解决,各别问题支持Java语言和Python语言。

如果对代码仓有任何问题,欢迎联系我:)

电子邮件:[email protected]

知乎: 刘宇波 http://www.zhihu.com/people/liuyubobobo

知乎专栏:是不是很酷 https://zhuanlan.zhihu.com/liuyubobobo

个人公众号:是不是很酷:)

QRCode

知识星球(免费)

zsxq


其他相关代码仓

Problems

IDProblemOfficial
Solution
C++JavaPython
001Two SumsolutionC++Java
002Add Two NumberssolutionC++
003Longest Substring Without Repeating CharacterssolutionC++Java
004Median of Two Sorted ArrayssolutionC++Java
005Longest Palindromic SubstringsolutionC++
006Zigzag ConversionsolutionC++
007Reverse IntegersolutionC++
008String to Integer (atoi)solutionC++
010Regular Expression MatchingsolutionC++
011Container With Most WatersolutionC++
012Integer to Roman[无]C++
013Roman to Integer[无]C++
014Longest Common Prefix[无]C++
0153Sum[无]C++
0163Sum Closest[无]C++
017Letter Combinations of a Phone NumbersolutionC++Java
0184Sum[无]C++
019Remove Nth Node From End of ListsolutionC++Java
020Valid ParenthesessolutionC++Java
021Merge Two Sorted ListssolutionC++
022Generate ParenthesessolutionC++JavaPython
023Merge k Sorted ListssolutionC++
024Swap Nodes in Pairs[无]C++Java
025Reverse Nodes in k-Group[无]C++
026Remove Duplicates from Sorted ArraysolutionC++
027Remove ElementsolutionC++
028Implement strStr()[无]
[缺:完整BM算法, 其他模式匹配算法]
C++
029Divide Two Integerssolution
[缺:不使用乘法加法除法]
C++
030Substring with Concatenation of All WordssolutionC++
031Next PermutationsolutionC++
033Search in Rotated Sorted ArraysolutionC++
034Search for a RangesolutionC++
035Search Insert PositionsolutionC++
036Valid SudokusolutionC++
037Sudoku Solversolution
[缺:Dancing Links]
C++C++
038Count and Say[无]C++
039Combination Sum[无]C++
040Combination Sum II[无]C++
041First Missing PositivesolutionC++
042Trapping Rain WatersolutionC++
043Multiply StringssolutionC++
045Jump Game IIsolutionC++
046Permutationssolution
[缺:排列算法整理]
C++Java
047Permutations II[无]C++
048Rotate ImagesolutionC++
049Group AnagramssolutionC++
050Pow(x, n)[无]C++
051N-Queens[缺:N皇后问题整理]C++Java
052N-Queens IIsolution
[缺:N皇后问题整理]
C++
053Maximum SubarraysolutionC++
054Spiral MatrixsolutionC++
055Jump GamesolutionC++
056Merge IntervalssolutionC++
057Insert IntervalsolutionC++
058Length of Last WordsolutionC++
059Spiral Matrix II[无]C++
061Rotate ListsolutionC++
062Unique Paths[无]
[缺:数学解]
C++
063Unique Paths IIsolutionC++
064Minimum Path SumsolutionC++JavaPython
065Valid NumbersolutionC++
066Plus One[无]C++
067Add Binary[无]C++
068Text Justification[无]C++
069Sqrt(x)[无]C++
070Climbing StairssolutionC++Java
071Simplify Path[无]C++
072Edit DistancesolutionC++
073Set Matrix ZeroessolutionC++
074Search a 2D Matrix[无]C++
075Sort ColorssolutionC++JavaPython
076Minimum Window SubstringsolutionC++
077CombinationssolutionC++Java
078SubsetssolutionC++
079Word Search[无]C++Java
080Remove Duplicates from Sorted Array II[无]C++
081Search in Rotated Sorted Array IIsolutionC++
082Remove Duplicates from Sorted List II[无]C++
083Remove Duplicates from Sorted List[无]C++
084Largest Rectangle in Histogramsolution 题解C++
085Maximal RectanglesolutionC++
086Partition ListsolutionC++
087Scramble String[无]C++
088Merge Sorted ArraysolutionC++Java
089Gray Code[无]C++
090Subsets II[无]C++
091Decode Ways[无]C++
092Reverse Linked List IIsolutionC++
093Restore IP AddressessolutionC++
094Binary Tree Inorder TraversalsolutionC++Java
095Unique Binary Search Trees IIsolutionC++
096Unique Binary Search TreessolutionC++
097Interleaving Stringsolution
[缺:DP]
C++
098Validate Binary Search TreesolutionC++Java
099Recover Binary Search Tree[无]Java
100Same TreesolutionC++
101Symmetric TreesolutionC++Python
102Binary Tree Level Order TraversalsolutionC++Java
103Binary Tree Zigzag Level Order Traversal[无]C++
104Maximum Depth of Binary TreesolutionC++Java
105Construct Binary Tree from Preorder and Inorder TraversalsolutionC++
106Construct Binary Tree from Inorder and Postorder Traversal[无]C++
107Binary Tree Level Order Traversal II[无]C++
108Convert Sorted Array to Binary Search Tree[无]C++
109Convert Sorted List to Binary Search TreesolutionC++
110Balanced Binary TreesolutionC++
111Minimum Depth of Binary TreesolutionC++
112Path SumsolutionC++Java
113Path Sum II[无]C++
114Flatten Binary Tree to Linked ListsolutionC++
115Distinct Subsequences[无]C++Java
116Populating Next Right Pointers in Each Node[无]C++
117Populating Next Right Pointers in Each Node II[无]C++
118Pascal's TrianglesolutionC++
119Pascal's Triangle II[无]C++
120Triangle[无]C++
121Best Time to Buy and Sell StockC++
122Best Time to Buy and Sell Stock IIsolutionC++
123Best Time to Buy and Sell Stock IIIC++
124Binary Tree Maximum Path SumsolutionC++
125Valid Palindrome[无]C++
126Word Ladder II[无]
[缺:双端搜索]
C++
127Word LaddersolutionC++Java
128Longest Consecutive SequenceC++
129Sum Root to Leaf Numbers[无]C++
130Surrounded Regions[无]C++
131Palindrome Partitioningsolution
[缺:DP]
C++
132Palindrome Partitioning II[无]C++
133Clone Graph[无]C++
134Gas StationsolutionC++
135Candysolution
[缺:O(1)空间算法]
C++
136Single NumbersolutionC++
137Single Number IIsolutionC++
138Copy List with Random PointersolutionC++
139Word BreaksolutionC++
141Linked List CyclesolutionC++
142Linked List Cycle IIsolutionC++
143Reorder List[无]C++
144Binary Tree Preorder TraversalsolutionC++Java
145Binary Tree Postorder TraversalsolutionC++Java
146LRU Cachesolution
[缺:封装一个Double Linked List]
C++
147Insertion Sort List[无]C++
148Sort List[无]C++
149Max Points on a LinesolutionC++
150Evaluate Reverse Polish Notation[无]C++
151Reverse Words in a String[无]C++
152Maximum Product Subarraysolution
[缺:Linear]
C++Python
153Find Minimum in Rotated Sorted ArraysolutionC++
155Min Stack[无]C++
159Longest Substring with At Most Two Distinct CharacterssolutionC++
160Intersection of Two Linked ListssolutionC++
161One Edit DistancesolutionC++
162Find Peak ElementsolutionC++
163Missing RangessolutionC++
164Maximum Gapsolution
[缺:桶排序]
C++
165Compare Version NumberssolutionC++
166Fraction to Recurring DecimalsolutionC++
167Two Sum II - Input array is sortedsolutionC++Java
168Excel Sheet Column Title[无]C++
169Majority ElementsolutionC++Python
170Two Sum III - Data structure design[无]C++
171Excel Sheet Column Number[无]C++
172Factorial Trailing ZeroessolutionC++
173Binary Search Tree Iterator[无]
[缺:Morris遍历]
C++
174Dungeon GamesolutionC++
175Database Problem: Link----
176Database Problem: Link----
179Largest Number[无]C++
181Database Problem: Link----
184Database Problem: Link----
186Reverse Words in a String II[无]C++
188Best-Time-to-Buy-and-Sell-Stock-IVC++
189Rotate ArraysolutionC++
190Reverse BitssolutionC++
191Number of 1 BitssolutionC++
196Database Problem: Link----
197Database Problem: Link----
198House RobbersolutionC++Java
199Binary Tree Right Side ViewsolutionC++
200Number of IslandssolutionC++Java
201Bitwise AND of Numbers RangesolutionC++
202Happy NumbersolutionC++
203Remove Linked List Elements[无]C++Java
204Count Primes[无]C++
205Isomorphic Strings[无]C++
206Reverse Linked ListsolutionC++Java
207Course Schedule[无]C++
208Implement Trie (Prefix Tree)solutionC++
209Minimum Size Subarray SumsolutionC++Java
210Course Schedule IIsolutionC++
211Add and Search Word - Data structure design[无]C++Java
212Word Search II[无]C++
213House Robber II[无]C++
215Kth Largest Element in an ArraysolutionC++
216Combination Sum III[无]C++
217Contains Duplicate[无]C++
218The Skyline ProblemC++
219Contains Duplicate IIsolutionC++Java
220Contains Duplicate IIIsolutionC++Java
221Maximal SquaresolutionC++Python
222Count Complete Tree Nodes[无]C++
223Rectangle Area[无]C++
224Basic Calculator[无]C++
225Implement Stack using QueuessolutionC++
226Invert Binary TreesolutionC++JavaPython
227Basic Calculator II[无]C++
228Summary RangessolutionC++
229Majority Element IIsolution
[缺:BM Voting]
C++
230Kth Smallest Element in a BSTsolution
[缺:非递归]
C++
231Power of TwosolutionC++
232Implement Queue using StackssolutionC++
233Number of Digit Onesolution
[缺:数学方法]
C++
234Palindrome Linked List[无]C++
235Lowest Common Ancestor of a Binary Search TreesolutionC++Java
236Lowest Common Ancestor of a Binary Treesolution
[缺:非递归解法;LCA问题总结]
C++
237Delete Node in a Linked ListsolutionC++Java
238Product of Array Except SelfsolutionC++Python
239Sliding Window MaximumsolutionC++
240Search a 2D Matrix IIsolution
[缺:分治]
C++
241Different Ways to Add Parentheses[无]C++
242Valid AnagramsolutionC++
243Shortest Word DistancesolutionC++
244Shortest Word Distance IIsolutionC++
245Shortest Word Distance III[无]C++
246Strobogrammatic NumbersolutionC++
247Strobogrammatic Number II[无]C++
248Strobogrammatic Number III[无]C++
249Group Shifted Strings[无]C++
250Count Univalue SubtreessolutionC++
251Flatten 2D VectorsolutionC++
252Meeting RoomssolutionC++
253Meeting Rooms IIsolutionC++
254Factor Combinations[无]C++
256Paint House[无]C++
257Binary Tree PathssolutionC++Java
258Add DigitssolutionC++
2593Sum SmallersolutionC++
260Single Number IIIsolutionC++
261Graph Valid TreeC++
263Ugly Number[无]C++
264Ugly Number IIsolutionC++
265Paint House IIC++
266Palindrome PermutationsolutionC++
267Palindrome Permutation IIsolutionC++
268Missing NumbersolutionC++
269Alien DictionarysolutionC++
273Integer to English WordssolutionC++
274H-Indexsolution
[缺:非二分]
C++
275H-Index IIsolutionC++
276Paint FencesolutionC++
277Find the Celebritysolution
[缺:O(n) 解法]
C++
278First Bad VersionsolutionC++
279Perfect Squares[无]
四平方和数学解
C++Java
280Wiggle SortsolutionC++
282Expression Add OperatorssolutionC++
283Move ZeroessolutionC++Java
284Peeking IteratorsolutionC++
285Inorder Successor in BST[无]
[缺:空间O(h)]
C++
286Walls and GatessolutionC++
287Find the Duplicate NumberC++
288Unique Word AbbreviationsolutionC++
289Game of LifesolutionC++
290Word Pattern[无]C++
292Nim GamesolutionC++
295Find Median from Data Stream[无]C++
296Best Meeting PointsolutionC++
297Serialize and Deserialize Binary TreesolutionC++
298Binary Tree Longest Consecutive SequencesolutionC++
299Bulls and CowssolutionC++
300Longest Increasing SubsequencesolutionC++Java
3010301-Remove-Invalid-Parenthesessolution
[缺:DP+构建]
C++
303Range Sum Query - ImmutableC++
304Range Sum Query 2D - ImmutablesolutionC++
305Number of Islands IIsolutionC++
306Additive Number[无]C++
307Range Sum Query - Mutable[缺:BIT]C++
308Range Sum Query 2D - MutableC++
309Best Time to Buy and Sell Stock with CooldownsolutionC++
310Minimum Height TreessolutionC++
311Sparse Matrix Multiplication[无]C++
312Burst Balloonssolution 题解C++
313Super Ugly Number[无]C++
314Binary Tree Vertical Order Traversal[无]C++
315Count of Smaller Numbers After Self[无]C++
316Remove Duplicate LetterssolutionC++
317Shortest Distance from All BuildingssolutionC++
318Maximum Product of Word LengthssolutionC++
319Bulb Switcher[无]C++
321Create Maximum Number[无]C++
322Coin ChangesolutionC++
323Number of Connected Components in an Undirected GraphsolutionC++
324Wiggle Sort II[无]C++
325Maximum Size Subarray Sum Equals ksolutionC++
326Power of ThreesolutionC++
328Odd Even Linked ListsolutionC++
329Longest Increasing Path in a MatrixsolutionC++
330Patching Array[无]C++
331Verify Preorder Serialization of a Binary TreesolutionC++
332Reconstruct ItinerarysolutionC++
334Increasing Triplet SubsequencesolutionC++
335Self Crossing[无]C++
336Palindrome PairssolutionC++
337House Robber III[无]C++
338Counting BitssolutionC++
339Nested List Weight Sum[无]C++
340Longest Substring with At Most K Distinct CharacterssolutionC++
341Flatten Nested List Iterator[无]C++
342Power of FoursolutionC++
343Integer Break[无]C++Java
344Reverse String[无]C++
345Reverse Vowels of a String[无]C++
346Moving Average from Data Stream[无]C++
347Top K Frequent ElementssolutionC++Java
348Find Winner on a Tic Tac Toe Game[无]C++
349Intersection of Two ArrayssolutionC++Java
350Intersection of Two Arrays II[无]C++Java
352Data Stream as Disjoint Intervals[无]C++
354Russian Doll EnvelopessolutionC++
357Count Numbers with Unique Digits[无]C++
359Logger Rate Limiter[无]C++
360Sort Transformed Array[无]C++
362Design Hit Counter[无]C++
363Max Sum of Rectangle No Larger Than K[无]C++
364Nested List Weight Sum II[无]C++
365Water and Jug Problem题解
[缺:数学解法]
C++
366Find Leaves of Binary TreesolutionC++
367Valid Perfect SquaresolutionC++
368Largest Divisible SubsetsolutionC++
369Plus One Linked ListsolutionC++
370Range AdditionC++
372Super Pow[无]C++
373Find K Pairs with Smallest Sums[无]C++
374Guess Number Higher or LowersolutionC++
375Guess Number Higher or Lower II[无]C++
376Wiggle SubsequencesolutionC++
[缺:DP;O(1) 空间贪心]
377Combination Sum IV[无]C++
378Kth Smallest Element in a Sorted Matrix[无]C++
380Insert Delete GetRandom O(1)[无]C++
381Insert Delete GetRandom O(1) - Duplicates allowed[无]C++
382Linked List Random Node[无]C++
383Ransom NotesolutionC++
384Shuffle an ArraysolutionC++
385Mini Parser[无]C++
386Lexicographical NumbersC++
387First Unique Character in a StringsolutionC++Java
388Longest Absolute File PathC++
389Find the DifferenceC++
390Elimination GameC++
391Perfect Rectangle[缺:矩形求交]C++
392Is Subsequence[无]C++
393UTF-8 ValidationsolutionC++
394Decode String[无]C++
395Longest Substring with At Least K Repeating Characterssolution
[缺:滑动窗口]
C++
396Rotate Function[无]C++
397Integer Replacement[无]C++
398Random Pick Index[无]C++
399Evaluate Divisionsolution
[缺:UF]
C++
400Nth Digit[无]C++
401Binary Watch[无]C++
402Remove K Digitssolution 题解C++
403Frog Jumpsolution
[缺:dp]
C++
404Sum of Left Leaves[无]C++
405Convert a Number to Hexadecimal[无]C++
406Queue Reconstruction by Height[无]C++
407Trapping Rain Water II[无]C++
410Split Array Largest Sumsolution 题解C++
412Fizz BuzzsolutionC++
413Arithmetic SlicessolutionC++
414Third Maximum Number[无]C++
415Add StringssolutionC++
416Partition Equal Subset Sum[无]C++Java
417Pacific Atlantic Water FlowC++Java
419Battleships in a Board[无]C++
420Strong Password Checker[无]C++
421Maximum XOR of Two Numbers in an ArraysolutionC++
422Valid Word Square[无]C++
423Reconstruct Original Digits from EnglishsolutionC++
424Longest Repeating Character Replacement[无]C++
426Convert Binary Search Tree to Sorted Doubly Linked ListsolutionC++
427Construct Quad Tree[无]C++
429N-ary Tree Level Order Traversal[无]C++
430Flatten a Multilevel Doubly Linked List[无]C++
431Encode N-ary Tree to Binary TreesolutionC++
432All O one Data Structure[无] [缺:O(1)]C++
433Minimum Genetic Mutation[无]C++
434Number of Segments in a String[无]C++
435Non-overlapping IntervalssolutionC++Java
436Find Right Interval[无]C++
437Path Sum III[无]C++Java
438Find All Anagrams in a String[无]C++
439Ternary Expression Parser[无]C++
440K-th Smallest in Lexicographical Order[无] [缺:更简单的实现]C++
441Arranging CoinssolutionC++
442Find All Duplicates in an ArraysolutionC++
443String CompressionC++
444Sequence Reconstruction[无]C++
445Add Two Numbers II[无]C++
446Arithmetic Slices II - SubsequencesolutionC++
447Number of Boomerangs[无]C++Java
448Find All Numbers Disappeared in an ArraysolutionC++
449Serialize and Deserialize BSTsolutionC++
450Delete Node in a BSTsolutionC++
451Sort Characters By Frequency[无]C++Java
452Minimum Number of Arrows to Burst BalloonssolutionC++
453Minimum Moves to Equal Array ElementssolutionC++
4544Sum II[无]C++Java
455Assign Cookies[无]C++Java
456132 Patternsolution
[缺:O(n) 单调栈算法]
C++
457Circular Array Loop[无]C++
458Poor PigssolutionC++
459Repeated Substring Pattern[无]C++
460LFU CachesolutionC++
461Hamming DistancesolutionC++
462Minimum Moves to Equal Array Elements IIsolutionC++
463Island PerimetersolutionC++
464Can I Win[无]C++
467Unique Substrings in Wraparound String[无]C++
468Validate IP Address[无]C++
470Implement Rand10() Using Rand7()solutionC++
472Concatenated Words[无]C++
473Matchsticks to SquaresolutionC++
474Ones and ZeroessolutionC++
475Heaters[无]C++
476Number ComplementsolutionC++
477Total Hamming Distancesolution 题解C++
478Generate Random Point in a CirclesolutionC++
479Largest Palindrome Product[无]C++
480Sliding Window Median[无]
[缺:双数据结构]
C++
481Magical String[无]C++
482License Key Formatting[无]C++
483Smallest Good Base[无]C++
484Find PermutationsolutionC++
485Max Consecutive Ones[无]C++
486Predict the Winner[无]C++
487Max Consecutive Ones II[无]C++
488Zuma Game[无]C++
489Robot Room CleanersolutionC++
490The MazesolutionC++
491Non-decreasing Subsequences[无]C++
492Construct the Rectangle[无]C++
494Target SumsolutionC++
495Teemo AttackingsolutionC++
496Next Greater Element IsolutionC++
497Random Point in Non-overlapping RectanglessolutionC++
498Diagonal Traverse[无]C++
500Keyboard Row[无]C++
501Find Mode in Binary Search Tree[无]C++
502IPOsolutionC++
503Next Greater Element IIsolutionC++
504Base 7[无]C++
505The Maze IIsolutionC++
506Relative Ranks[无]C++
507Perfect NumbersolutionC++
508Most Frequent Subtree Sum[无]C++
509Fibonacci Number[无]C++
510Inorder Successor in BST II[无]C++
511Database Problem: Link----
513Find Bottom Left Tree Value[无]C++
515Find Largest Value in Each Tree Row[无]C++
516Longest Palindromic Subsequence[无]C++
517Super Washing MachinessolutionC++
518Coin Change 2[无]C++
519Random Flip MatrixsolutionC++
520Detect CapitalsolutionC++
521Longest Uncommon Subsequence IsolutionC++
522Longest Uncommon Subsequence IIsolutionC++
523Continuous Subarray Sum[无]C++
524Longest Word in Dictionary through DeletingsolutionC++
525Contiguous Arraysolution 题解C++
526Beautiful ArrangementsolutionC++
527Word AbbreviationsolutionC++
528Random Pick with WeightsolutionC++
529Minesweeper[无]C++
530Minimum Absolute Difference in BST[无]Java
531Lonely Pixel I[无]C++
532K-diff Pairs in an ArraysolutionC++
533Lonely Pixel II[无]C++
536Construct Binary Tree from Stringsolution
[缺:stack]
C++
537Complex Number MultiplicationsolutionC++
538Convert BST to Greater TreesolutionC++
539Minimum Time Difference[无]C++
540Single Element in a Sorted ArraysolutionC++
541Reverse String IIsolutionC++
54201 MatrixsolutionC++
543Diameter of Binary TreesolutionC++
546Remove BoxessolutionC++
547Number of ProvincessolutionC++
549Binary Tree Longest Consecutive Sequence IIsolutionC++
551Student Attendance Record IsolutionC++
552Student Attendance Record IIsolutionC++
553Optimal Divisionsolution
[缺:O(n) 解法]
C++
554Brick WallsolutionC++
556Next Greater Element IIIsolution
[缺:底层实现]
C++
557Reverse Words in a String IIIsolutionC++
558Logical OR of Two Binary Grids Represented as Quad-Trees[无]C++
559Maximum Depth of N-ary TreesolutionC++
560Subarray Sum Equals KsolutionC++
561Array Partition IsolutionC++
563Binary Tree TiltsolutionC++
564Find the Closest Palindrome[无]C++
565Array NestingsolutionC++
566Reshape the MatrixsolutionC++
567Permutation in Stringsolution 题解C++
570Database Problem: Link----
572Subtree of Another TreesolutionC++
573Squirrel SimulationsolutionC++
575Distribute CandiessolutionC++
576Out of Boundary PathssolutionC++
580Database Problem: Link----
581Shortest Unsorted Continuous Subarraysolution
[缺:Stack]
C++
582Kill ProcesssolutionC++
583Delete Operation for Two StringssolutionC++
584Database Problem: Link----
586Database Problem: Link----
587Erect the Fencesolution 题解
[缺:凸包解法整理]
C++
589N-ary Tree Preorder TraversalsolutionC++
590N-ary Tree Postorder TransversalsolutionC++
591Tag ValidatorsolutionC++
592Fraction Addition and Subtraction[无]C++
593Valid SquaresolutionC++
594Longest Harmonious SubsequencesolutionC++
595Database Problem: Link----
598Range Addition IIC++
599Minimum Index Sum of Two ListssolutionC++
600Non-negative Integers without Consecutive Onessolution
[缺:Bit Manipulation]
C++
605Can Place FlowerssolutionC++
606Construct String from Binary TreesolutionC++
607Database Problem: Link----
608Database Problem: Link----
609Find Duplicate File in SystemsolutionC++
611Valid Triangle NumbersolutionC++
617Merge Two Binary TreesC++
619Database Problem: Link----
621Task SchedulersolutionC++
622Design Circular Queue[无]C++
623Add One Row to TreesolutionC++
627Database Problem: Link----
628Maximum Product of Three NumberssolutionC++
629K-Inverse-Pairs-Arraysolution
[缺:其他 dp 优化思路]
C++
630Course Schedule IIIsolutionC++
632Smallest Range Covering Elements from K ListssolutionC++
633Sum of Square NumbersC++
636Exclusive Time of Functions[无]C++
637Average of Levels in Binary TreesolutionC++
638Shopping OfferssolutionC++
639Decode Ways IIsolution
[缺:DP]
C++
640Solve the Equation[无]C++
642Design Search Autocomplete System[无]C++
643Maximum Average Subarray IsolutionC++
644Maximum Average Subarray IIsolutionC++
645Set Mismatchsolution
[缺:空间 O(1) 解法]
C++
646Maximum Length of Pair ChainsolutionC++
647Palindromic SubstringssolutionC++
648Replace Words[无]C++
649Dota2 Senatesolution
[缺:队列]
C++
6502 Keys KeyboardsolutionC++
652Find Duplicate SubtreessolutionC++
653Two Sum IV - Input is a BST[无]C++
654Maximum Binary TreesolutionC++
655Print Binary Tree[无]C++
658Find K Closest Elementssolution
[缺:二分]
C++
659Split Array into Consecutive SubsequencessolutionC++
661Image Smoother[无]C++
662Maximum Width of Binary TreesolutionC++
664Strange PrintersolutionC++
665Non-decreasing ArraysolutionC++
666Path Sum IVsolutionC++
667Beautiful Arrangement IIsolutionC++
668Kth Smallest Number in Multiplication TablesolutionC++
669Trim a Binary Search TreesolutionC++
670Maximum Swap[无]C++
671Second Minimum Node In a Binary TreesolutionC++
672Bulb Switcher IIsolutionC++
673Number of Longest Increasing Subsequence[缺:BIT;线段树]C++
674Longest Continuous Increasing SubsequenceC++
675Cut Off Trees for Golf Event[缺:A*;Hadlock's Algo]C++
676Implement Magic DictionarysolutionC++
677Map Sum PairssolutionC++
678Valid Parenthesis StringsolutionC++
67924 GamesolutionC++
680Valid Palindrome II[无]C++
682Baseball GamesolutionC++
684Redundant ConnectionsolutionC++
685Redundant Connection IIsolutionC++
686Repeated String Match[无]C++
687Longest Univalue PathsolutionC++
688Knight Probability in ChessboardsolutionC++
689Maximum Sum of 3 Non-Overlapping SubarrayssolutionC++
690Employee ImportancesolutionC++
691Stickers to Spell Word[无]C++
692Top K Frequent WordssolutionC++
693Binary Number with Alternating Bits[无]C++
694Number of Distinct Islands[review: hash的方式]C++
695Max-Area-of-IslandC++
696Count Binary SubstringsC++
697Degree of an ArrayC++
698Partition to K Equal Sum SubsetsC++Java
699Falling Squares[缺:线段树;块状链表]C++
700Search in a Binary Search TreesolutionC++
701Insert into a Binary Search TreesolutionC++
703Kth Largest Element in a Stream[无]C++
704Binary SearchsolutionC++
705Design HashSet[无]C++
706Design HashMap[无]C++
707Design Linked List[无]C++
708Insert into a Cyclic Sorted List[无]C++
709To Lower CasesolutionC++
710Random Pick with BlacklistsolutionC++
711Number of Distinct Islands II[review: hash的方式]C++
712Minimum ASCII Delete Sum for Two StringsC++
713Subarray Product Less Than KC++
714Best Time to Buy and Sell Stock with Transaction FeeC++
715Range Module[缺:set查找]C++
716Max StacksolutionC++
7171-bit and 2-bit CharactersC++
718Maximum Length of Repeated Subarray[缺:Rolling Hash]C++
719Find K-th Smallest Pair DistancesolutionC++
720Longest Word in DictionarysolutionC++
721Accounts MergesolutionC++
722Remove CommentssolutionC++
723Candy CrushsolutionC++
724Find Pivot IndexsolutionC++
725Split Linked List in PartssolutionC++
726Number of AtomssolutionC++
727Minimum Window SubsequencesolutionC++
728Self Dividing NumberssolutionC++
729My Calendar IsolutionC++
730Count Different Palindromic Subsequences[无]C++
731My Calendar IIsolutionC++
732My Calendar IIIsolutionC++
733Flood FillsolutionC++
734Sentence SimilaritysolutionC++
735Asteroid CollisionsolutionC++
736Parse Lisp ExpressionsolutionC++
737Sentence Similarity IIsolutionC++
739Daily TemperaturessolutionC++
740Delete and EarnsolutionC++
741Cherry Pickupsolution
[缺:自底向上的动态规划]
C++
745Prefix and Suffix SearchsolutionC++
746Min Cost Climbing StairssolutionC++
747Largest Number At Least Twice of OtherssolutionC++
749Contain Virus[无]C++
752Open the LocksolutionC++
753Cracking the Safe[无]C++
754Reach a NumberSolutionC++
757Set Intersection Size At Least Two[无]C++
761Special Binary StringsolutionC++
762Prime Number of Set Bits in Binary Representation[无]C++
763Partition Labels[无]C++
764Largest Plus SignC++
765Couples Holding HandssolutionC++
766Toeplitz MatrixsolutionC++
771Jewels and StonessolutionC++
772Basic Calculator III[无]C++
774Minimize Max Distance to Gas StationsolutionC++
775Global and Local InversionsC++
779K-th Symbol in Grammar[无]C++
780Reaching PointssolutionC++
781Rabbits in ForestsolutionC++
782Transform to ChessboardsolutionC++
783Minimum Distance Between BST NodessolutionC++
784Letter Case PermutationsolutionC++
785Is Graph Bipartite?solutionC++
786K-th Smallest Prime Fractionsolution
[缺:分治算法]
C++
787Cheapest Flights Within K Stopssolution
[缺:使用Heap]
C++
788Rotated DigitssolutionC++
789Escape The GhostssolutionC++
790Domino and Tromino Tilingsolution
[缺:转移矩阵求幂解法]
C++
791Custom Sort StringsolutionC++
792Number of Matching SubsequencessolutionC++
793Preimage Size of Factorial Zeroes FunctionsolutionC++
794Valid Tic-Tac-Toe StatesolutionC++
795Number of Subarrays with Bounded MaximumsolutionC++
796Rotate Stringsolution
[缺:Rolling Hash]
C++
797All Paths From Source to TargetsolutionC++
798Smallest Rotation with Highest Scoresolution
[缺:O(n) 解法]
C++
799Champagne TowersolutionC++
800Similar RGB ColorsolutionC++
802Find Eventual Safe StatessolutionC++
803Bricks Falling When Hit[无]C++
804Unique Morse Code WordssolutionC++
805Split Array With Same AveragesolutionC++
806Number of Lines To Write StringsolutionC++
807Max Increase to Keep City SkylinesolutionC++
809Expressive WordssolutionC++
810Chalkboard XOR GamesolutionC++
811Subdomain Visit CountsolutionC++
813Largest Sum of AveragessolutionC++
814Binary Tree PruningsolutionC++
815Bus RoutessolutionC++
817Linked List ComponentssolutionC++
819Most Common WordsolutionC++
822Card Flipping Game[无]C++
823Binary Trees With FactorssolutionC++
824Goat Latin[无]C++
825Friends Of Appropriate Ages[无]C++
827Making A Large Island[无]C++
828Count Unique Characters of All Substrings of a Given String[无]C++
829Consecutive Numbers Sum[无]C++
830Positions of Large GroupssolutionC++
831Masking Personal Information[无]C++
832Flipping an ImagesolutionC++
833Find And Replace in String[无]C++
834Sum of Distances in TreesolutionC++
835Image Overlap[无]C++
837New 21 Game[无]C++
838Push DominoessolutionC++
839Similar String Groupssolution
C++
841Keys and RoomssolutionC++
842Split Array into Fibonacci SequencesolutionC++
844Backspace String ComparesolutionC++
846Hand of Straights[无]C++
847Shortest Path Visiting All Nodes[无]C++
848Shifting Letters[无]C++
849Maximize Distance to Closest Person[无]C++
850Rectangle Area IIsolutionC++
851Loud and RichsolutionC++
852Peak Index in a Mountain ArraysolutionC++
853Car FleetsolutionC++
854K-Similar StringssolutionC++
855Exam RoomsolutionC++
856Score of ParenthesessolutionC++
857Minimum Cost to Hire K Workerssolution
[缺:二分搜索]
C++
858Mirror ReflectionsolutionC++
859Buddy StringssolutionC++
860Lemonade ChangesolutionC++
861Score After Flipping MatrixsolutionC++
863All Nodes Distance K in Binary TreesolutionC++
864Shortest Path to Get All Keyssolution
[缺:Dijkstra]
C++
865Smallest Subtree with all the Deepest NodessolutionC++
866Prime PalindromesolutionC++
867Transpose MatrixsolutionC++
868Binary GapsolutionC++
869Reordered Power of 2solutionC++
870Advantage ShufflesolutionC++
871Minimum Number of Refueling Stopssolution 题解C++
872Leaf-Similar TreessolutionC++
873Length of Longest Fibonacci SubsequencesolutionC++
874Walking-Robot-SimulationsolutionC++
875Koko Eating BananassolutionC++
876Middle of the Linked ListsolutionC++
877Stone GamesolutionC++
878Nth Magical NumbersolutionC++
879Profitable SchemessolutionC++
880Decoded String at IndexsolutionC++
881Boats to Save PeoplesolutionC++
882Reachable Nodes In Subdivided GraphsolutionC++
883Projection Area of 3D ShapessolutionC++
884Uncommon Words from Two SentencessolutionC++
885Spiral Matrix IIIsolutionC++
886Possible BipartitionsolutionC++
888Fair Candy SwapsolutionC++
889Construct Binary Tree from Preorder and Postorder TraversalsolutionC++
890Find and Replace PatternsolutionC++
891Sum of Subsequence WidthssolutionC++
892Surface Area of 3D ShapessolutionC++
893Groups of Special-Equivalent StringssolutionC++
894All Possible Full Binary TreessolutionC++
895Maximum Frequency StacksolutionC++
896Monotonic ArraysolutionC++Python
897Increasing Order Search TreesolutionC++
898Bitwise ORs of SubarrayssolutionC++
899Orderly QueuesolutionC++
900RLE IteratorsolutionC++
901Online Stock SpansolutionC++
902Numbers At Most N Given Digit SetsolutionC++
903Valid Permutations for DI Sequencesolution
[缺:O(n^2) DP]
C++
904Fruit Into BasketssolutionC++
905Sort Array By ParitysolutionC++
906Super PalindromessolutionC++
907Sum of Subarray MinimumssolutionC++
908Smallest Range IsolutionC++
909Snakes and LadderssolutionC++
910Smallest Range IIsolutionC++
911Online ElectionsolutionC++
912Sort an Array[无]C++
913Cat and Mouse Gamesolution
[缺:DFS拓扑排序;DP]
C++
914X of a Kind in a Deck of CardssolutionC++
915Partition Array into Disjoint IntervalssolutionC++
916Word SubsetssolutionC++
917Reverse Only LetterssolutionC++
918Maximum Sum Circular SubarraysolutionC++
919Complete Binary Tree InsertersolutionC++
920Number of Music Playlistssolution
[缺:生成函数]
C++
921Minimum Add to Make Parentheses ValidsolutionC++
922Sort Array By Parity IIsolutionC++
9233Sum With MultiplicitysolutionC++
924Minimize Malware SpreadsolutionC++
925Long Pressed NamesolutionC++
926Flip String to Monotone IncreasingsolutionC++
927Three Equal PartssolutionC++
928Minimize Malware Spread IIsolutionC++
929Unique Email AddressessolutionC++
930Binary Subarrays With SumsolutionC++
931Minimum Path Falling SumsolutionC++
932Beautiful ArraysolutionC++
933Number of Recent CallssolutionC++
934Shortest BridgesolutionC++
935Knight DialersolutionC++
936Stamping The SequencesolutionC++
937Reorder Log FilessolutionC++
938Range Sum of BSTsolutionC++
939Minimum Area RectanglesolutionC++
940Distinct Subsequences IIsolutionC++
941Valid Mountain ArraysolutionC++
942DI String MatchsolutionC++
943Find the Shortest Superstringsolution
[缺:动态规划]
C++
944Delete Columns to Make SortedsolutionC++
945Minimum Increment to Make Array UniquesolutionC++
946Validate Stack SequencessolutionC++
947Most Stones Removed with Same Row or ColumnsolutionC++
948Bag of TokenssolutionC++
949Largest Time for Given DigitssolutionC++
950Reveal Cards In Increasing OrdersolutionC++
951Flip Equivalent Binary TreessolutionC++
952Largest Component Size by Common FactorsolutionC++
953isAlienSortedsolutionC++
954Array of Doubled PairssolutionC++
955Delete Columns to Make Sorted IIsolutionC++
956Tallest BillboardsolutionC++
957Prison Cells After N DayssolutionC++
958Check Completeness of a Binary TreesolutionC++
959Regions Cut By SlashessolutionC++
960Delete Columns to Make Sorted IIIsolutionC++
961N-Repeated Element in Size 2N ArraysolutionC++
965Univalued Binary TreesolutionC++
966Vowel SpellcheckersolutionC++
967Numbers With Same Consecutive DifferencessolutionC++
968Binary Tree CamerassolutionC++
969Pancake SortingsolutionC++
970Powerful IntegerssolutionC++
971Flip Binary Tree To Match Preorder TraversalsolutionC++
972Equal Rational NumberssolutionC++
973K Closest Points to OriginsolutionC++
974Subarray Sums Divisible by KsolutionC++
975Odd Even JumpsolutionC++
976Largest Perimeter TrianglesolutionC++
977Squares of a Sorted ArraysolutionC++
978Longest Turbulent Subarraysolution
[缺:滑动窗口 & dp]
C++
979Distribute Coins in Binary TreesolutionC++
980Unique Paths IIIsolution
[缺:记忆化搜索]
C++Java
981Time Based Key-Value StoresolutionC++
982Triples with Bitwise AND Equal To Zero[无]C++
983Minimum Cost For TicketssolutionC++
984String Without AAA or BBBsolutionC++
985Sum of Even Numbers After QueriessolutionC++
986Interval List IntersectionssolutionC++
987Vertical Order Traversal of a Binary TreesolutionC++
988Smallest String Starting From LeafsolutionC++
989Add to Array-Form of IntegersolutionC++
990Satisfiability of Equality EquationssolutionC++
991Broken CalculatorsolutionC++
992Subarrays with K Different IntegerssolutionC++
993Cousins in Binary TreesolutionC++
994Rotting OrangessolutionC++
995Minimum Number of K Consecutive Bit FlipssolutionC++
996Number of Squareful ArrayssolutionC++
997Find the Town Judge[无]C++
998Maximum Binary Tree II[无]C++
999Available Captures for Rook[无]C++
1000Minimum Cost to Merge Stones[无]C++
1001Grid Illumination[无]C++
1002Find Common Characters[无]C++
1003Check If Word Is Valid After Substitutions[无]C++
1004Max Consecutive Ones III[无]C++
1005Maximize Sum Of Array After K Negations[无]C++
1006Clumsy Factorial[无]C++
1007Minimum Domino Rotations For Equal Row[无]C++
1008Construct Binary Search Tree from Preorder Traversal[无]C++
1009Complement of Base 10 Integer[无]C++
1010Pairs of Songs With Total Durations Divisible by 60[无]C++
1011Capacity To Ship Packages Within D Days[无]C++
1012Numbers With 1 Repeated Digit[无]C++
1013Partition Array Into Three Parts With Equal Sum[无]C++
1014Best Sightseeing Pair[无]C++
1015Smallest Integer Divisible by K[无]C++
1016Binary String With Substrings Representing 1 To N[无]C++
1017Convert to Base -2[无]C++
1018Binary Prefix Divisible By 5[无]C++
1019Next Greater Node In Linked List[无]C++
1020Number of Enclaves[无]C++
1021Remove Outermost Parentheses[无]C++
1022Sum of Root To Leaf Binary Numbers[无]C++
1023Camelcase Matching[无]C++
1024Video Stitching[无]C++
1025Divisor Game[无]C++
1026Maximum Difference Between Node and Ancestor[无]C++
1027Longest Arithmetic Sequence[无]C++
1028Recover a Tree From Preorder Traversal[无]C++
1029Two City Scheduling[无]C++
1030Matrix Cells in Distance Order[无]C++
1031Maximum Sum of Two Non-Overlapping Subarrays[无]C++
1032Stream of Characters[无]C++
1033Moving Stones Until Consecutive[无]C++
1034Coloring A Border[无]C++
1035Uncrossed Lines[无]C++
1036Escape a Large Maze[无]C++
1037Valid Boomerang[无]C++
1038Binary Search Tree to Greater Sum Tree[无]C++
1039Minimum Score Triangulation of Polygon[无]C++
1040Moving Stones Until Consecutive II[无]C++
1041Robot Bounded In Circle[无]C++
1042Flower Planting With No Adjacent[无]C++
1043Partition Array for Maximum Sum[无]C++
1044Longest Duplicate Substring[无]
[缺:后缀数组]
C++
1046Last Stone Weight[无]C++
1047Remove All Adjacent Duplicates In String[无]C++
1049Last Stone Weight II[无]C++
1050Database Problem: Link----
1051Height Checker[无]C++
1052Grumpy Bookstore Owner[无]C++
1053Previous Permutation With One Swap[无]C++
1054Distant Barcodes[无]C++
1055Shortest Way to Form String[无]C++
1056Confusing Number[无]C++
1059All Paths from Source Lead to DestinationsolutionC++
1061Lexicographically Smallest Equivalent String[无]C++
1062Longest Repeating Substring[无]C++
1065Index Pairs of a String[无][C++](1001-1500/106

Truncated — view the full README on GitHub.

algorithm-challenges
algorithm-competitions
algorithms
interview-questions
leetcode-cpp
leetcode-solutions

Significant stargazers

JustSong

1,944 followers · starred Apr 2022

Hawstein

1,285 followers · starred Aug 2018

injuly

251 followers · starred Nov 2020

Blake Li

5 followers · starred Apr 2021