Skip to content

these exercises all from book or network , and practice them to enhance comprehension

Notifications You must be signed in to change notification settings

wsqyouth/algorithm_study

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode

LeetCode Algorithm

(Notes: 这里参考陈浩的结构,但是采用主题式学习法,对题目进行分类)

Category # Title Difficulty Solution_Go Solution_Cpp
1 Two Sum Easy Go C++
2 Add Two Numbers Medium
3 Longest Substring Without Repeating Characters Medium done
4 Median of Two Sorted Arrays Hard
5 Longest Palindromic Substring Medium done
6 ZigZag Conversion Easy
7 Reverse Integer Easy
8 String to Integer (atoi) Easy
9 Palindrome Number Easy
10 Regular Expression Matching Hard
11 Container With Most Water Medium
12 Integer to Roman Medium
13 Roman to Integer Easy
14 Longest Common Prefix Easy
15 3Sum Medium done
16 3Sum Closest Medium
17 Letter Combinations of a Phone Number Medium
18 4Sum Medium done
19 Remove Nth Node From End of List Easy done
20 Valid Parentheses Easy done
21 Merge Two Sorted Lists Easy done
22 Generate Parentheses Medium
23 Merge k Sorted Lists Hard done
24 Swap Nodes in Pairs Medium
25 Reverse Nodes in k-Group Hard done
26 Remove Duplicates from Sorted Array Easy
27 Remove Element Easy
28 Implement strStr() Easy
29 Divide Two Integers Medium
30 Substring with Concatenation of All Words Hard
31 Next Permutation Medium
32 Longest Valid Parentheses Hard
33 Search in Rotated Sorted Array Hard done
34 Search for a Range Medium
35 Search Insert Position Medium
36 Valid Sudoku Easy
37 Sudoku Solver Hard
38 Count and Say Easy
39 Combination Sum Medium
40 Combination Sum II Medium
41 First Missing Positive Hard
42 Trapping Rain Water Hard done
43 Multiply Strings Medium
44 Wildcard Matching Hard
45 Jump Game II Hard
46 Permutations Medium done
47 Permutations II Hard
48 Rotate Image Medium
49 Group Anagrams Medium
50 "Pow(x, n)" Medium
51 N-Queens Hard
52 N-Queens II Hard
53 Maximum Subarray Medium
54 Spiral Matrix Medium done
55 Jump Game Medium
56 Merge Intervals Hard
57 Insert Interval Hard
58 Length of Last Word Easy
59 Spiral Matrix II Medium
60 Permutation Sequence Medium
61 Rotate List Medium
62 Unique Paths Medium
63 Unique Paths II Medium
64 Minimum Path Sum Medium
65 Valid Number Easy
66 Plus One Easy
67 Add Binary Easy
68 Text Justification Hard
69 Sqrt(x) Medium
70 Climbing Stairs Easy
71 Simplify Path Medium
72 Edit Distance Hard
73 Set Matrix Zeroes Medium
74 Search a 2D Matrix Medium
75 Sort Colors Medium
76 Minimum Window Substring Hard
77 Combinations Medium
78 Subsets Medium
79 Word Search Medium
80 Remove Duplicates from Sorted Array II Medium
81 Search in Rotated Sorted Array II Medium
82 Remove Duplicates from Sorted List II Medium done
83 Remove Duplicates from Sorted List Easy done
84 Largest Rectangle in Histogram Hard
85 Maximal Rectangle Hard
86 Partition List Medium
87 Scramble String Hard
88 Merge Sorted Array Easy
89 Gray Code Medium
90 Subsets II Medium
91 Decode Ways Medium
92 Reverse Linked List II Medium done
93 Restore IP Addresses Medium
94 Binary Tree Inorder Traversal Medium
95 Unique Binary Search Trees II Medium
96 Unique Binary Search Trees Medium
97 Interleaving String Hard
98 Validate Binary Search Tree Medium
99 Recover Binary Search Tree Hard
100 Same Tree Easy
101 Symmetric Tree Easy
102 Binary Tree Level Order Traversal Easy
103 Binary Tree Zigzag Level Order Traversal Medium done
104 Maximum Depth of Binary Tree Easy
105 Construct Binary Tree from Preorder and Inorder Traversal Medium
106 Construct Binary Tree from Inorder and Postorder Traversal Medium
107 Binary Tree Level Order Traversal II Easy
108 Convert Sorted Array to Binary Search Tree Medium
109 Convert Sorted List to Binary Search Tree Medium
110 Balanced Binary Tree Easy
111 Minimum Depth of Binary Tree Easy
112 Path Sum Easy
113 Path Sum II Medium
114 Flatten Binary Tree to Linked List Medium
115 Distinct Subsequences Hard
116 Populating Next Right Pointers in Each Node Medium
117 Populating Next Right Pointers in Each Node II Hard
118 Pascal's Triangle Easy
119 Pascal's Triangle II Easy
120 Triangle Medium
121 Best Time to Buy and Sell Stock Medium done
122 Best Time to Buy and Sell Stock II Medium
123 Best Time to Buy and Sell Stock III Hard
124 Binary Tree Maximum Path Sum Hard
125 Valid Palindrome Easy
126 Word Ladder II Hard
127 Word Ladder Medium
128 Longest Consecutive Sequence Hard
129 Sum Root to Leaf Numbers Medium
130 Surrounded Regions Medium
131 Palindrome Partitioning Medium
132 Palindrome Partitioning II Hard
133 Clone Graph Medium
134 Gas Station Medium
135 Candy Hard
136 Single Number Medium
137 Single Number II Medium
138 Copy List with Random Pointer Hard
139 Word Break Medium
140 Word Break II Hard
141 Linked List Cycle Medium
142 Linked List Cycle II Medium
143 Reorder List Medium
144 Binary Tree Preorder Traversal Medium
145 Binary Tree Postorder Traversal Hard
146 LRU Cache Hard done
147 Insertion Sort List Medium
148 Sort List Medium
149 Max Points on a Line Hard
150 Evaluate Reverse Polish Notation Medium
151 Reverse Words in a String Medium
152 Maximum Product Subarray Medium
153 Find Minimum in Rotated Sorted Array Medium
154 Find Minimum in Rotated Sorted Array II Hard
155 Min Stack Easy
156 Binary Tree Upside Down done Medium
157 Read N Characters Given Read4 done Easy
158 Read N Characters Given Read4 II - Call multiple times done Hard
159 Longest Substring with At Most Two Distinct Characters done Hard
160 Intersection of Two Linked Lists Easy done
161 One Edit Distancedone Medium
162 Find Peak Element Medium
163 Missing Ranges done Medium
164 Maximum Gap Hard
165 Compare Version Numbers Easy
166 Fraction to Recurring Decimal Medium
167 Two Sum II - Input array is sorted done Medium
168 Excel Sheet Column Title Easy
169 Majority Element Easy
170 Two Sum III - Data structure design done Easy
171 Excel Sheet Column Number Easy
172 Factorial Trailing Zeroes Easy
173 Binary Search Tree Iterator Medium
174 Dungeon Game Hard
179 Largest Number Medium
186 Reverse Words in a String II done Medium
187 Repeated DNA Sequences Medium
188 Best Time to Buy and Sell Stock IV Hard
189 Rotate Array Easy
190 Reverse Bits Easy
191 Number of 1 Bits Easy
198 House Robber Easy
199 Binary Tree Right Side View Medium done
200 Number of Islands Medium done
201 Bitwise AND of Numbers Range Medium
202 Happy Number Easy
203 Remove Linked List Elements Easy done
204 Count Primes Easy
205 Isomorphic Strings Easy
206 Reverse Linked List Easy done
207 Course Schedule Medium
208 Implement Trie (Prefix Tree) Medium
209 Minimum Size Subarray Sum Medium
210 Course Schedule II Medium
211 Add and Search Word - Data structure design Medium
212 Word Search II Hard
213 House Robber II Medium
214 Shortest Palindrome Hard
215 Kth Largest Element in an Array Medium done
216 Combination Sum III Medium
217 Contains Duplicate Easy
218 The Skyline Problem Hard
219 Contains Duplicate II Easy
220 Contains Duplicate III Medium
221 Maximal Square Medium
222 Count Complete Tree Nodes Medium
223 Rectangle Area Easy
224 Basic Calculator Medium
225 Implement Stack using Queues Medium
226 Invert Binary Tree Easy
227 Basic Calculator II Medium
228 Summary Ranges Easy
229 Majority Element II Medium
230 Kth Smallest Element in a BST Medium
231 Power of Two Easy
232 Implement Queue using Stacks Easy
233 Number of Digit One Medium
234 Palindrome Linked List Easy
235 Lowest Common Ancestor of a Binary Search Tree Easy
236 Lowest Common Ancestor of a Binary Tree Medium
237 Delete Node in a Linked List Easy done
238 Product of Array Except Self Medium
239 Sliding Window Maximum Hard
240 Search a 2D Matrix II Medium
241 Different Ways to Add Parentheses Medium
242 Valid Anagram Easy
257 Binary Tree Paths Easy
258 Add Digits Easy
260 Single Number III Medium
263 Ugly Number Easy
264 Ugly Number II Medium
268 Missing Number Medium
273 Integer to English Words Medium
274 H-Index Medium
275 H-Index II Medium
278 First Bad Version Easy
279 Perfect Squares Medium
282 Expression Add Operators Hard
283 Move Zeroes Easy
284 Peeking Iterator Medium
285 Inorder Successor in BST Medium done
287 Find the Duplicate Number Hard
289 Game of Life Medium
290 Word Pattern Easy
292 Nim Game Easy
295 Find Median from Data Stream Hard
297 Serialize and Deserialize Binary Tree Medium
299 Bulls and Cows Easy
300 Longest Increasing Subsequence Medium done
301 Remove Invalid Parentheses Hard
303 Range Sum Query - Immutable Easy
304 Range Sum Query 2D - Immutable Medium
306 Additive Number Medium
307 Range Sum Query - Mutable Medium
309 Best Time to Buy and Sell Stock with Cooldown Medium
310 Minimum Height Trees Medium
312 Burst Balloons Hard
313 Super Ugly Number Medium
315 Count of Smaller Numbers After Self Hard
316 Remove Duplicate Letters Hard
318 Maximum Product of Word Lengths Medium
319 Bulb Switcher Medium
321 Create Maximum Number Hard
322 Coin Change Medium
324 Wiggle Sort II Medium
326 Power of Three Easy
327 Count of Range Sum Hard
328 Odd Even Linked List Easy done
329 Longest Increasing Path in a Matrix Medium
330 Patching Array Medium
331 Verify Preorder Serialization of a Binary Tree Medium
332 Reconstruct Itinerary Medium
334 Increasing Triplet Subsequence Medium
336 Palindrome Pairs Hard
337 House Robber III Medium
338 Counting Bits Medium
341 Flatten Nested List Iterator Medium
342 Power of Four Easy
343 Integer Break Medium
344 Reverse String Easy
345 Reverse Vowels of a String Easy
347 Top K Frequent Elements Medium
349 Intersection of Two Arrays Easy
350 Intersection of Two Arrays II Easy
357 Count Numbers with Unique Digits Medium
367 Valid Perfect Square Easy
371 Sum of Two Integers Easy
376 Wiggle Subsequence Medium
377 Combination Sum IV Medium
380 Insert Delete GetRandom O(1) Hard
381 Insert Delete GetRandom O(1) - Duplicates allowed Hard
382 Linked List Random Node Medium
383 Ransom Note Easy
384 Shuffle an Array Medium
385 Mini Parser Medium
386 Lexicographical Numbers Medium
387 First Unique Character in a String Easy
388 Longest Absolute File Path Medium
389 Find the Difference Easy
390 Elimination Game Medium
391 Perfect Rectangle Hard
392 Is Subsequence Medium
393 UTF-8 Validation Medium
394 Decode String Medium
395 Longest Substring with At Least K Repeating Characters Medium
396 Rotate Function Easy
397 Integer Replacement Medium
398 Random Pick Index Medium
399 Evaluate Division Medium
400 Nth Digit Medium
401 Binary Watch Easy
402 Remove K Digits Medium
403 Frog Jump Hard
404 Sum of Left Leaves Easy
405 Convert a Number to Hexadecimal Easy
406 Queue Reconstruction by Height Medium
409 Longest Palindrome Easy
410 Split Array Largest Sum Hard
412 Fizz Buzz Easy
413 Arithmetic Slices Medium
414 Third Maximum Number Easy
415 Add Strings Easy
416 Partition Equal Subset Sum Medium
418 SentenceScreenFitting done Easy
437 Path Sum III Medium
438 Find all Anagrams in a string Medium
449 Serialize and Deserialize BST Medium
450 DeleteNodeInABST Medium
463 Island Perimeter Easy
477 Total Hamming Distance Medium
494 Target Sum Medium
497 Random Point in Non-overlapping Rectangles Medium
509 Fibonacci Number Easy
518 Coin Change 2 Medium
520 Detect Capital Easy
532 K-diff Pairs in an Array Easy
538 Convert BST to Greater Tree Easy
543 Diameter of Binary Tree Easy
547 Friend Circles Medium
563 Binary Tree Tilt Easy
572 Subtree of Another Tree Easy
581 Shortest Unsorted Continuous Subarray Easy
623 Add One Row to Tree Medium
628 Maximum Product of Three Numbers Easy
643 Maximum Average Subarray I Easy
647 Palindromic Substrings Medium
652 Find Duplicate Subtrees Medium
655 Print Binary Tree Medium
661 Image Smoother Easy
662 Maximum Width of Binary Tree Medium
665 Non-decreasing Array Easy
671 Second Minimum Node In a Binary Tree Easy
674 Longest Continuous Increasing Subsequence Easy
684 Redundant Connection Medium
687 Longest Univalue Path Easy
695 Max Area of Island Medium
712 Minimum ASCII Delete Sum for Two Strings Medium
714 Best Time to Buy and Sell Stock with Transaction Fee Medium
717 1-bit and 2-bit Characters Easy
721 Accounts Merge Medium
746 Min Cost Climbing Stairs Easy
747 Largest Number At Least Twice of Others Easy
771 Jewels and Stones Easy
804 Unique Morse Code Words Easy
820 Short Encoding of Words Medium
830 Positions of Large Groups Easy
837 Most Common Word Easy
844 Backspace String Compare Easy
849 Maximize Distance to Closest Person Easy
852 Peak Index in a Mountain Array Easy
858 Mirror Reflection Medium
859 Buddy Strings Easy
876 Middle of the Linked List Easy done
905 Sort Array By Parity Easy
914 X of a Kind in a Deck of Cards Easy
922 Sort Array By Parity II Easy
929 Unique Email Addresses Easy
931 Minimum Falling Path Sum Medium
933 Number of Recent Calls Easy
941 Valid Mountain Array Easy
950 Reveal Cards In Increasing Order Medium
951 Flip Equivalent Binary Trees Medium
958 Check Completeness of a Binary Tree Medium
961 N-Repeated element in size 2N Array Easy
969 Pancake Sorting Medium
971 Flip Binary Tree To Match Preorder Traversal Medium
976 Largest Perimeter Triangle Easy
977 Squares of a Sorted Array Easy
978 Longest Turbulent Subarray Medium
979 Distribute Coins in Binary Tree Medium
980 Unique Paths III Hard
981 Time Based Key-Value Store Medium
982 Triples with Bitwise AND Equal To Zero Hard
983 Minimum Cost For Tickets Medium
984 String Without AAA or BBB Easy
985 Sum of Even Numbers After Queries Easy
986 Interval List Intersections Medium
987 Vertical Order Traversal of a Binary Tree Medium
988 Smallest String Starting From Leaf Medium
989 Add to Array-Form of Integer Easy
990 Satisfiability of Equality Equations Medium
991 Broken Calculator Medium
993 Cousins in Binary Tree Easy
1024 Video Stitching Medium
1028 Recover a Tree From Preorder Traversal Hard
1029 Two City Scheduling Easy
1030 Matrix Cells in Distance Order Easy
1071 Greatest Common Divisor of Strings Easy
1170 Compare Strings by Frequency of the Smallest Character Easy
1207 Unique Number of Occurrences Easy
1333 Filter Restaurants by Vegan-Friendly, Price and Distance Medium
1353 Maximum Number of Events That Can Be Attended Medium
1376 Time Needed to Inform All Employees Medium
1460 Make Two Arrays Equal by Reversing Sub-arrays Easy
1464 Maximum Product of Two Elements in an Array Easy
1470 Shuffle the Array Easy
1513 Number of Substrings With Only 1s Medium
1523 Count Odd Numbers in an Interval Range Easy
1524 Number of Sub-arrays With Odd Sum Medium
1525 Number of Good Ways to Split a String Medium
1535 Find the Winner of an Array Game Medium
1541 Minimum Insertions to Balance a Parentheses String Medium
1550 Three Consecutive Odds Easy
1551 Minimum Operations to Make Array Equal Medium
1556 Thousand Separator Easy
1573 Number of Ways to Split a String Medium
1605 Find Valid Matrix Given Row and Column Sums Medium
1732 Find the Highest Altitude Easy
1733 Minimum Number of People to Teach Medium
1734 Decode XORed Permutation Medium
1748 Sum of Unique Elements Easy
1749 Maximum Absolute Sum of Any Subarray Medium
1750 Minimum Length of String After Deleting Similar Ends Medium
1751 Maximum Number of Events That Can Be Attended II Hard
1752 Check if Array Is Sorted and Rotated Easy
1753 Maximum Score From Removing Stones Medium
1754 Largest Merge Of Two Strings Medium
1755 Closest Subsequence Sum Hard
1758 Minimum Changes To Make Alternating Binary String Easy
1759 Count Number of Homogenous Substrings Medium
1760 Minimum Limit of Balls in a Bag Medium
1761 Minimum Degree of a Connected Trio in a Graph Hard
1763 Longest Nice Substring Easy
1784 Check if Binary String Has at Most One Segment of Ones Easy
1785 Minimum Elements to Add to Form a Given Sum Medium
1786 Number of Restricted Paths From First to Last Node Medium

ref_shell

cat README.md | awk -F '|' '{print "| |"$2"|",$3"|",$5,"|| |"}' > my.md

About

these exercises all from book or network , and practice them to enhance comprehension

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published