Skip to content

Latest commit

History

857 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

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: liuyubobobo@gmail.com


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

由于 Leetcode 如今已经问题量巨大,所以很多同学可能会刷起来毫无头绪。推荐大家可以使用 Leetcode 在2017年底推出的 Leetcode Explore,这个模块分门别类地整理了Leetcode上的问题,是一个很好的刷 Leetcode 的指引。Leetcode Explore模块上的题解,可以参考我的代码仓:Play Leetcode Explore

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

个人网站liuyubobobo.com [废弃重整中...]

电子邮件liuyubobobo@gmail.com

微博: 刘宇波bobo http://weibo.com/liuyubobobo

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

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

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

QRCode

其他相关代码仓

Problems

IDProblemOfficial
Solution
C++JavaPython
001Two SumsolutionC++Java
002Add Two NumberssolutionC++
003Longest Substring Without Repeating CharacterssolutionC++Java
004Median of Two Sorted ArrayssolutionC++
005Longest Palindromic SubstringsolutionC++
007Reverse IntegersolutionC++
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++
033Search in Rotated Sorted ArraysolutionC++
034Search for a RangesolutionC++
036Valid SudokusolutionC++
037Sudoku Solversolution
[缺:Dancing Links]
C++
038Count and Say[无]C++
039Combination Sum[无]C++
040Combination Sum II[无]C++
041First Missing PositivesolutionC++
042Trapping Rain WatersolutionC++
046Permutationssolution
[缺:排列算法整理]
C++Java
047Permutations II[无]C++
048Rotate ImagesolutionC++
049Group AnagramssolutionC++
050Pow(x, n)[无]C++
051N-Queens[缺:N皇后问题整理]C++Java
052N-Queens IIsolution
[缺:N皇后问题整理]
C++
054Spiral MatrixsolutionC++
056Merge IntervalssolutionC++
059Spiral Matrix II[无]C++
061Rotate ListsolutionC++
062Unique Paths[无]
[缺:数学解]
C++
063Unique Paths IIsolutionC++
064Minimum Path SumsolutionC++JavaPython
066Plus One[无]C++
067Add Binary[无]C++
069Sqrt(x)[无]C++
070Climbing StairssolutionC++Java
072Edit DistancesolutionC++
073Set Matrix ZeroessolutionC++
074Search a 2D Matrix[无]C++
075Sort ColorssolutionC++JavaPython
076Minimum Window SubstringsolutionC++
077CombinationssolutionC++Java
079Word Search[无]C++Java
080Remove Duplicates from Sorted Array II[无]C++
082Remove Duplicates from Sorted List II[无]C++
086Partition ListsolutionC++
087Scramble String[无]C++
088Merge Sorted ArraysolutionC++
092Reverse Linked List IIsolutionC++
093Restore IP AddressessolutionC++
094Binary Tree Inorder TraversalsolutionC++Java
095Unique Binary Search Trees IIsolutionC++
096Unique Binary Search TreessolutionC++
098Validate Binary Search TreesolutionC++Java
099Recover Binary Search Tree[无]Java
100Same TreesolutionC++
101Symmetric TreesolutionC++Python
102Binary Tree Level Order TraversalsolutionC++Java
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++
111Minimum Depth of Binary TreesolutionC++
112Path SumsolutionC++Java
113Path Sum II[无]C++
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 IIC++
123Best Time to Buy and Sell Stock IIIC++
125Valid Palindrome[无]C++
126Word Ladder II[无]
[缺:双端搜索]
C++
127Word LaddersolutionC++Java
128Longest Consecutive SequenceC++
129Sum Root to Leaf Numbers[无]C++
130Surrounded Regions[无]C++
133Clone Graph[无]C++
134Gas StationsolutionC++
135Candysolution
[缺:O(1)空间算法]
C++
136Single NumbersolutionC++
138Copy List with Random PointersolutionC++
141Linked List CyclesolutionC++
142Linked List Cycle IIsolutionC++
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 Subarray[无]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++
167Two Sum II - Input array is sortedsolutionC++Java
169Majority ElementsolutionC++Python
170Two Sum III - Data structure design[无]C++
171Excel Sheet Column Number[无]C++
173Binary Search Tree Iterator[无]
[缺:Morris遍历]
C++
186Reverse Words in a String II[无]C++
188Best-Time-to-Buy-and-Sell-Stock-IVC++
189Rotate ArraysolutionC++
191Number of 1 BitssolutionC++
198House RobbersolutionC++Java
200Number of IslandssolutionC++Java
202Happy Number[无]C++
203Remove Linked List Elements[无]C++Java
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 SquaresolutionPython
222Count Complete Tree Nodes[无]C++
224Basic Calculator[无]C++
225Implement Stack using QueuessolutionC++
226Invert Binary TreesolutionC++JavaPython
227Basic Calculator II[无]C++
230Kth Smallest Element in a BSTsolution
[缺:非递归]
C++
232Implement Queue using StackssolutionC++
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 SelfsolutionPython
239Sliding Window MaximumsolutionC++
242Valid AnagramsolutionC++
243Shortest Word DistancesolutionC++
244Shortest Word Distance IIsolutionC++
245Shortest Word Distance III[无]C++
249Group Shifted Strings[无]C++
250Count Univalue SubtreessolutionC++
252Meeting RoomssolutionC++
253Meeting Rooms IIsolutionC++
254Factor Combinations[无]C++
257Binary Tree PathssolutionC++Java
2593Sum SmallersolutionC++
268Missing NumbersolutionC++
279Perfect Squares[无]
四平方和数学解
C++Java
282Expression Add OperatorssolutionC++
283Move ZeroessolutionC++Java
286Walls and GatessolutionC++
287Find the Duplicate NumberC++
288Unique Word AbbreviationsolutionC++
290Word Pattern[无]C++
297Serialize and Deserialize Binary TreesolutionC++
300Longest Increasing SubsequencesolutionC++Java
3010301-Remove-Invalid-Parenthesessolution
[缺:DP+构建]
C++
303Range Sum Query - ImmutableC++
307Range Sum Query - Mutable[缺:BIT]C++
308Range Sum Query 2D - MutableC++
309Best Time to Buy and Sell Stock with CooldownC++
315Count of Smaller Numbers After Self[无]C++
319Bulb Switcher[无]C++
322Coin ChangesolutionC++
328Odd Even Linked ListsolutionC++
337House Robber III[无]C++
340Longest Substring with At Most K Distinct CharacterssolutionC++
341Flatten Nested List Iterator[无]C++
343Integer Break[无]C++Java
344Reverse String[无]C++
345Reverse Vowels of a String[无]C++
346Moving Average from Data Stream[无]C++
347Top K Frequent ElementssolutionC++Java
349Intersection of Two ArrayssolutionC++Java
350Intersection of Two Arrays II[无]C++Java
359Logger Rate Limiter[无]C++
360Sort Transformed Array[无]C++
370Range AdditionC++
373Find K Pairs with Smallest Sums[无]C++
374Guess Number Higher or LowersolutionC++
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++
384Shuffle an ArraysolutionC++
386Lexicographical NumbersC++
387First Unique Character in a StringsolutionC++Java
388Longest Absolute File PathC++
389Find the DifferenceC++
390Elimination GameC++
391Perfect Rectangle[缺:矩形求交]C++
393UTF-8 ValidationsolutionC++
394Decode String[无]C++
398Random Pick Index[无]C++
404Sum of Left Leaves[无]C++
412Fizz BuzzsolutionC++
416Partition Equal Subset Sum[无]C++Java
417Pacific Atlantic Water Flow[无]Java
423Reconstruct Original Digits from EnglishsolutionC++
426Convert Binary Search Tree to Sorted Doubly Linked ListsolutionC++
429N-ary Tree Level Order Traversal[无]C++
430Flatten a Multilevel Doubly Linked List[无]solution
434Number of Segments in a StringC++
435Non-overlapping IntervalssolutionC++Java
437Path Sum III[无]C++Java
438Find All Anagrams in a String[无]C++
443String CompressionC++
447Number of Boomerangs[无]C++Java
450Delete Node in a BSTsolutionC++
451Sort Characters By Frequency[无]C++
4544Sum II[无]C++Java
455Assign Cookies[无]C++Java
458Poor PigssolutionC++
470Implement Rand10() Using Rand7()solutionC++
473Matchsticks to SquaresolutionC++
474Ones and ZeroessolutionC++
478Generate Random Point in a CirclesolutionC++
485Max Consecutive Ones[无]C++
490The MazesolutionC++
494Target SumsolutionC++
497Random Point in Non-overlapping RectanglessolutionC++
498Diagonal Traverse[无]C++
501Find Mode in Binary Search Tree[无]C++
509Fibonacci Number[无]C++
518Coin Change 2[无]C++
519Random Flip MatrixsolutionC++
528Random Pick with WeightsolutionC++
530Minimum Absolute Difference in BST[无]Java
541Reverse String IIsolutionC++
54201 MatrixsolutionC++
557Reverse Words in a String IIIsolutionC++
559Maximum Depth of N-ary TreesolutionC++
561Array Partition IsolutionC++
563Binary Tree TiltsolutionC++
572Subtree of Another TreesolutionC++
583Delete Operation for Two StringssolutionC++
589N-ary Tree Preorder TraversalsolutionC++
590N-ary Tree Postorder TransversalsolutionC++
598Range Addition IIC++
599Minimum Index Sum of Two ListssolutionC++
600Non-negative Integers without Consecutive Onessolution
[缺:Bit Manipulation]
C++
622Design Circular Queue[无]C++
637Average of Levels in Binary TreesolutionC++
642Design Search Autocomplete System[无]C++
648Replace Words[无]C++
652Find Duplicate SubtreessolutionC++
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++
684Redundant ConnectionsolutionC++
685Redundant Connection IIsolutionC++
690Employee ImportancesolutionC++
692Top K Frequent WordssolutionC++
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++
701Insert into a Binary Search TreesolutionC++
704Binary SearchsolutionC++
705Design HashSet[无]C++
706Design HashMap[无]C++
707Design Linked List[无]C++
708Insert into a Cyclic Sorted List[无]C++
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 Distance[缺:二分搜索]C++
720Longest Word in DictionarysolutionC++
721Accounts MergesolutionC++
722Remove CommentssolutionC++
723Candy CrushsolutionC++
724Find Pivot IndexsolutionC++
725Split Linked List in PartssolutionC++
727Minimum Window SubsequencesolutionC++
728Self Dividing NumberssolutionC++
729My Calendar IsolutionC++
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++
746Min Cost Climbing StairssolutionC++
747Largest Number At Least Twice of OtherssolutionC++
752Open the LocksolutionC++
765Couples Holding HandssolutionC++
766Toeplitz MatrixsolutionC++
771Jewels and StonessolutionC++
772Basic Calculator III[无]C++
780Reaching PointssolutionC++
781Rabbits in ForestsolutionC++
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++
799Champagne TowersolutionC++
800Similar RGB ColorsolutionC++
804Unique Morse Code WordssolutionC++
805Split Array With Same AveragesolutionC++
806Number of Lines To Write StringsolutionC++
807Max Increase to Keep City SkylinesolutionC++
809Expressive WordssolutionC++
811Subdomain Visit CountsolutionC++
817Linked List ComponentssolutionC++
819Most Common WordsolutionC++
841Keys and RoomssolutionC++
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 StopssolutionC++
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++
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++
957Prison Cells After N DayssolutionC++
958Check Completeness of a Binary TreesolutionC++
959Regions Cut By SlashessolutionC++
960Delete Columns to Make Sorted IIIsolutionC++
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 SubarraysolutionC++
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++
1072Flip Columns For Maximum Number of Equal Rows[无]C++
1078Occurrences After Bigram[无]C++
1079Letter Tile Possibilities[无]C++
1080Insufficient Nodes in Root to Leaf Paths[无]C++
1089Duplicate Zeros[无]C++
1090Largest Values From Labels[无]C++
1091Shortest Path in Binary Matrix[无]C++
1092Shortest Common Supersequence[无]C++
1093Statistics from a Large Sample[无]C++
1094Car Pooling[无]C++
1095Find in Mountain Array[无]C++
1096Brace Expansion II[无]
[缺:非递归算法]
C++
1099Two Sum Less Than K[无]C++
1100Find K-Length Substrings With No Repeated Characters[无]C++
1101The Earliest Moment When Everyone Become Friends[无]C++
1102Path With Maximum Minimum Value[无]
[缺:并查集]
C++
1103Distribute Candies to PeoplesolutionC++
1104Path In Zigzag Labelled Binary Tree[无]C++
1105Filling Bookcase Shelves[无]C++
1106Parsing A Boolean Expression[无]
[缺:非递归算法]
C++
1108Defanging an IP Address[无]C++
1109Corporate Flight Bookings[无]C++
1110Delete Nodes And Return Forest[无]C++
1111Maximum Nesting Depth of Two Valid Parentheses Strings[无]C++
1118Number of Days in a Month[无]C++
1119Remove Vowels from a String[无]C++
1120Maximum Average Subtree[无]C++
1121Divide Array Into Increasing Sequences[无]C++
1124Longest Well-Performing Interval[无]C++
1128Number of Equivalent Domino Pairs[无]C++
1129Shortest Path with Alternating Colors[无]C++
1133Largest Unique Number[无]C++
1134Armstrong Number[无]C++
1135Connecting Cities With Minimum Cost[无]C++
1136Parallel Courses[无]
[缺:后序遍历拓扑排序]
C++
1137N-th Tribonacci Number[无]C++
1138Alphabet Board Path[无]C++
1139Largest 1-Bordered Square[无]C++
1140Stone Game II[无]C++

About

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语言。近乎所有问题都会提供多个算法解决。大家加油!:)

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages