Code Monkey home page Code Monkey logo

leetcode-rust-7's Introduction

  • problem number with ๐Ÿ”’ suffix need leetcode/lintcode subscription to unlock
  • problem number with ๐Ÿค” suffix has many solutions
  • problem number with โŒ suffix is a bad solution(like leetcode#371 Python can't do bitwise add)

codeforces_solutions

Problem Solution
1A - Theatre Square Rust
4A - Watermelon Rust
71A - Way Too Long Words Rust
158A - Next Round Rust
231A - Team Rust

leetcode_solutions

# Problem Solutions Category/Comment
1 Two Sum Rust, Java bitwise
2 Add Two Numbers Rust, Java, Go linked_list
3 Longest Substring Without Repeating Char... Rust sliding_window
4 Median of Two Sorted Arrays Rust, Python binary_search
5 Longest Palindromic Substring Rust, Python manacher, suffix_array
6 ZigZag Conversion Python
7 Reverse Integer Rust
8 String to Integer (atoi) Python
9 Palindromic Number Rust
10 Regular Expression Matching Python
11 Container With Most Water Rust
12 Integer to Roman Rust
13 Roman to Integer Rust
14 Longest Common Prefix Python
15 3Sum Python two_pointers, two_sum
16 3Sum Closest Python two_sum
17 Letter Combinations of a Phone Number Rust BFS
18 4Sum Python two_pointers, two_sum
19 Remove Nth Node From End of List Rust sliding_window
20 Valid Parentheses Python stack
21 Merge Two Sorted Lists Rust, Python
22 Generate Parentheses Python backtracking
23 Merge k Sorted Lists Python
24 Swap Nodes in Pairs Rust
26 Remove Duplicates from Sorted Array Rust
27 Remove Element Rust
28 Implement strStr() Rust, Python kmp, dfa
31 Next Permutation Python
33 Search in Rotated Sorted Array Python binary_search
34 Find First and Last Position of Element ... Rust
35 Search Insert Position Python
36 Valid Sudoku Python
37 Soduku Solver Python
38 Count And Say Rust
39 Combination Sum Python, Rust
40 Combination Sum II Python, Rust
42 Trapping Rain Water Rust
44 Wildcard Matching Python
45 Jump Game II Rust greedy
46 Permutations Python backtracking
47 Permutations II Python backtracking
48 Rotate Image Rust
49 Group Anagrams Rust
50 Pow(x, n) Rust
51 N Queens Python, Rust
52 N Queens II Python, Rust
53 Maximum Subarray Python greedy, dp
54 Spiral Matrix Rust
55 Jump Game Python greedy, dp
58 Length of Last Word Rust
59 Spiral Matrix II Rust
60 Permutation Sequence Python
62 Unique Paths Rust, Go combination
63 Unique Paths II Python
64 Minimum Path Sum Python
65 Valid Number Rust
66 Plus One Rust
67 Add Binary C++
69 Sqrt(x) Rust
70 Climb Stairs Rust fibonacci
72 Edit Distance Rust
73 Set Matrix Zeroes Rust
74 Search a 2D Matrix Rust
75 Sort Colors Python three_pointers, partition_array
77 Combinations Rust
78 Subsets Rust
79 Word Search Python
81 Search in Rotated Sorted Array II Python binary_search
82 Remove Duplicates from Sorted List II C++
83 Remove Duplicates from Sorted List C++
86 Partition List Rust
88 Merge Sorted Array Rust, Python merge_sort
89 Gray Code Rust
90 Subsets II Python
91 Decode Ways Python
92 Reverse Linked List II Python
93 Restore IP Addresses Rust
94 Binary Tree Inorder Traversal Python DFS, stack
98 Validate Binary Search Tree Rust
99 Recover Binary Search Tree Python
100 Same Tree Rust
102 Binary Tree Level Order Traversal Rust, Python
103 Binary Tree Zigzag Level Order Traversal Rust
104 Maximum Depth of Binary Tree Python
105 Construct Binary Tree from Preorder and Inorder Traversal Python DFS, stack
106 Construct Binary Tree from Inorder and Postorder Traversal Python DFS
107 Binary Tree Level Order Traversal II Rust
108 Convert Sorted Array to Binary Search Tree Python divide_and_conquer
109 Convert Sorted List to Binary Search Tree Python divide_and_conquer
110 Balanced Binary Tree Python divide_and_conquer
111 Minimum Depth of Binary Tree Python divide_and_conquer, BFS
114 Flatten Binary Tree to Linked List Python
118 Pascals Triangle Python
119 Pascals Triangle II Python
120 Triangle Rust
121 Best Time to Buy and Sell Stock Python
122 Best Time to Buy and Sell Stock II Python
123 Best Time to Buy and Sell Stock III Python
124 Binary Tree Maximum Path Sum Python
125 Valid Palindrome Python two_pointers
126 Word Ladder II Python BFS+DFS
127 Word Ladder Python ๅŒๅ‘BFS
128 Longest Consecutive Sequence Python ๅนถๆŸฅ้›†
129 Sum Root to Leaf Numbers Rust
130 Surrounded Regions Rust
133 Clone Graph Python DFS, BFS
134 Gas Station Rust
135 Candy Rust
136 Single Number Rust
137 Single Number II Rust
138 Copy List with Random Pointer Python
139 Word Break Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
140 Word Break II Python
141 Linked List Cycle Python
142 Linked List Cycle II Python
144 Binary Tree Preorder Traversal Rust
145 Binary Tree Postorder Traversal Python DFS, stack
146 LRU Cache Python double_linked_list, OrderedDict
147 Insertion Sort List Rust
148 Sort List Rust
150 Evaluate Reverse Polish Notation Rust
151 Reverse Words in a String Rust
153 Find Minimum in Rotated Sorted Array Python binary_search
154 Find Minimum in Rotated Sorted Array II Python binary_search
155 Min Stack Python
160 Intersection of Two Linked Lists Python
164 Maximum Gap Rust
167 Two Sum II - Input array is sorted Python two_pointers
169 Majority Element Rust
170๐Ÿ”’ Two Sum III - Data structure design Python two_pointers
172 Factorial Trailing Zeroes Python factorial
173 Binary Search Tree Iterator Python
174 Dungeon Game Rust
175 Combine Two Tables
176 Second Highest Salary SQL
181 Employees Earning More Than Their Managers SQL
182 Duplicate Emails SQL
183 Customers Who Never Order sql
188 Best Time to Buy and Sell Stock IV Python
189 Rotate Array Rust
190 Reverse Bits Rust
191 Number of 1 Bits Rust
198 House Robber Python
200 Number of Islands Python special_data_structure.union_find, DFS, BFS
202 Happy Number Python
203 Remove Linked List Elements Python
204 Count Primes Rust
206 Reverse Linked List Python, Rust
208 Implement Trie (Prefix Tree) Rust
207 Course Schedule Python BFS, topological_sorting
209 Minimum Size Subarray Sum Python sliding_window
210 Course Schedule II Python BFS, topological_sorting
212 Word Search II Python ๅ‰็ผ€ๆ ‘
213 House Robber II Python
215 Kth Largest Element in an Array Python quick_select, quick_sort, heap
216 Combination Sum III Rust
217 Contains Duplicate Rust
219 Contains Duplicate II Rust
222 Count Complete Tree Nodes Rust
224 Basic Calculator Rust
225 Implement Stack using Queues Python
226 Invert Binary Tree Rust
227 Basic Calculator II Rust
228 Summary Ranges Rust
230 Kth Smallest Element in a BST Python DFS, stack
231 Power of Two Rust
232 Implement Queue using Stacks Python
234 Palindrome Linked List Rust
235 Lowest Common Ancestor of a Binary Search Tree Python
236 Lowest Common Ancestor of a Binary Tree Python divide_and_conquer
238 Product of Array Except Self Rust
239 Sliding Window Maximum Rust
240 Search a 2D Matrix II Python
242 Valid Anagram Rust
257 Binary Tree Paths Python DFS, backtracking
260 Single Number III Rust
263 Ugly Number Rust
264 Ugly Number II Python
266๐Ÿ”’ Palindrome Permutation Python greedy
269๐Ÿ”’ Alien Dictionary Python heapq, topological_sorting
270๐Ÿ”’ Closest Binary Search Tree Value Python
272๐Ÿ”’ Closest Binary Search Tree Value II Python
278 First Bad Version Rust
279 Perfect Squares Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
283 Move Zeros Rust
287 Find the Duplicate Number Python ๅฟซๆ…ขๅŒๆŒ‡้’ˆ
290 Word Pattern Python
291๐Ÿ”’ Word Pattern II Python DFS
292 Nim Game Rust
297 Serialize and Deserialize Binary Tree Python serialize
300 Longest Increasing Subsequence Python ๆŽฅ้พ™ๅž‹ๅŠจๆ€่ง„ๅˆ’
302๐Ÿ”’ Smallest Rectangle Enclosing Black Pixels Python
303 Range Sum Query - Immutable Rust
304 Range Sum Query 2D - Immutable Rust
307 Range Sum Query - Mutable Python
309 Best Time to Buy and Sell Stock with Cooldown Python
311๐Ÿ”’ Sparse Matrix Multiplication Rust
312 Burst Balloons Rust
322 Coin Change Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
326 Power of Three Rust
328 Odd Even Linked List Python
337 House Robber III Python
338 Counting Bits Rust
341 Flatten Nested List Iterator Rust
342 Power of Four Rust
343 Integer Break Python ๅˆ’ๅˆ†็ฑปDP
344 Reverse String Rust
347 Top K Frequent Elements Rust
349 Intersection of Two Arrays Python
350 Intersection of Two Arrays II Python
354 Russian Doll Envelopes Python
355 Design Twitter Rust
359๐Ÿ”’ Logger Rate Limiter Rust
367 Valid Perfect Square Rust
368 Largest Divisible Subset Python
369๐Ÿ”’ Plus One Linked List Rust
371โŒ Sum of Two Integers Python binary_addition
377 Combination Sum IV Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
380 Insert Delete GetRandom O(1) Python
381 Insert Delete GetRandom O(1) - Duplicates allowed Python
386 Lexicographical Numbers Rust
387 First Unique Character in a String Rust
389 Find The Difference Rust
398 Random Pick Index Rust
404 Sum of Left Leaves Python
406 Queue Reconstruction by Height Rust
409 Longest Palindrome Python dp(greedy)
412 Fizz Buzz Rust
413 Arithmetic Slices Rust
415 Add String C++
416 Partition Equal Subset Sum Python 0-1่ƒŒๅŒ…้—ฎ้ข˜
426 Longest Repeating Character Replacement Python
429 N-ary Tree Level Order Traversal C++
448 Find All Numbers Disappeared in an Array Rust
449 Serialize and Deserialize BST Python DFS, stack
454 4Sum II Rust
455 Assign Cookies Rust
461 Hamming Distance Rust
463 Island Perimeter Rust
470 impl rand10 using rand7 Rust
474 Ones and Zeroes Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
477 Total Hamming Distance Rust
485 Max Consecutive Ones Rust
486 Validate IP Address Rust
490๐Ÿ”’ The Maze Rust
494 Target Sum Python 0-1่ƒŒๅŒ…้—ฎ้ข˜
498 Diagonal Traverse Python
503 Next Greater Element II Rust
507 Perfect Number Rust
509 Fibonacci Number Rust
514 Freedom Trail Rust
518 Coin Change 2 Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
535 Encode and Decode TinyURL very_easy
536๐Ÿ”’ Construct Binary Tree from String Python
538 Convert BST to Greater Tree Python
547 Friend Circles Rust
559 Maximum Depth of N-ary Tree C++
566 Reshape the Matrix Rust
567 Reverse Words in a String III C++
575 Distribute Candies Rust
589 N-ary Tree Preorder Traversal Python
590 N-ary Tree Postorder Traversal Python
595 Big Countries sql
606 Construct String from Binary Tree Python
617 Merge Two Binary Trees Python
605 Can Place Flowers Rust
610๐Ÿ”’ Triangle Judgement SQL
611 Valid Triangle Number Rust
613๐Ÿ”’ Shortest Distance in a Line SQL
620 Not Boring Movies SQL
625๐Ÿ”’ Minimum Factorization Python greedy
627 Swap Salary SQL
628 Maximum Product of Three Numbers Rust
633 Average of Levels in Binary Tree Python
643 Maximum Average Subarray I Rust
650 2 Keys Keyboard Rust
653 First Unique Number in Data Stream Python
657 Robot Return to Origin Rust
658 Find K Closest Elements Rust, Python binary_search
669 Trim A Binary Search Tree Python
674 Longest Continuous Increasing Subsequence Python
680 Valid Palindrome II Python two_pointers, greedy
682 Baseball Game Rust
695 Max Area of Island Rust
696 Count Binary Substrings Rust
700 Search in a Binary Search Tree Rust
702๐Ÿ”’ Search in a Sorted Array of Unknown Size Python binary_search_first, ๅ€ๅขžๆณ•
703 Kth Largest Element in a Stream Rust, Python
704 Binary Search Python binary_search
705 Design HashSet Python
706 Design HashMap Python
709 To Lower Case Rust
713 1-bit and 2-bit Characters Rust
714 Best Time to Buy and Sell Stock with Transaction Fee Python
716๐Ÿ”’ Max Stack Python
724 Find Pivot Index Rust
728 Self Dividing Numbers Rust
760๐Ÿ”’ Find Anagram Mappings Rust
796 Rotate String Python Rabin-Karp(rolling_hash), kmp
743 Network Delay Time Python
746 Min Cost Climbing Stairs Rust
763 Partition Labels Rust
766 Toeplitz Matrix Rust
771 Jewels and Stones Rust
788 Rotated Digits Rust
797 All Paths From Source to Target Rust
807 Max Increase to Keep City Skyline Rust
830 Positions of Large Groups Rust
832 Flipping an Image Rust
841 Keys and Rooms C++
844 Backspace String Compare Rust
845 Longest Mountain in Array Python mountain_array
852 Peak Index in a Mountain Array Python mountain_array, binary_search
860 Lemonade Change Rust
861 Score After Flipping Matrix Python greedy
867 Transpose Matrix Rust, Go, C++
869 Reordered Power of 2 Python permutation
875 Koko Eating Bananas Python
876 Middle of the Linked List Rust
887 Super Egg Drop Rust
888 Fair Candy Swap Rust
889 Construct Binary Tree from Preorder and Postorder... Python DFS
905 Sort Array By Parity Rust
912 Sort An Array Python
922 Sort Array By Parity II Rust
925 Long Pressed Name Rust
938 Range Sum of BST Rust
941 Valid Mountain Array Python mountain_array
942 DI String Match Rust
950 Reveal Cards In Increasing Order Rust
953 Verifying an Alien Dictionary Python
961 N-Repeated Element in Size 2N Array Rust
973 K Closest Points to Origin Rust quick_select
976 Largest Perimeter Triangle Rust
977 Squares of a Sorted Array Rust
989 Add to Array-Form of Integer Rust
1002 Find Common Characters Rust
1006 Clumsy Factorial Rust
1018 Binary Prefix Divisible By 5 Rust
1030 Matrix Cells in Distance Order Rust
1038 Binary Search Tree to Greater Sum Tree Python
1046 Last Stone Weight Python
1049 Last Stone Weight II Python 0-1่ƒŒๅŒ…้—ฎ้ข˜
1051 Height Checker Rust
1068๐Ÿ”’ Product Sales Analysis I SQL
1069๐Ÿ”’ Product Sales Analysis II SQL
1095 Find in Mountain Array Python binary_search, mountain_array
1099๐Ÿ”’ Two Sum Less Than K Python two_pointers
1108 Defanging an IP Address Rust
1128 Number of Equivalent Domino Pairs Rust
1109 Corporate Flight Bookings Rust
1119๐Ÿ”’ Remove Vowels from a String Rust
1134๐Ÿ”’ Armstrong Number Rust
1143 Longest Common Subsequence Python
1160 Find Words That Can Be Formed by Ch... Rust
1167๐Ÿ”’ Minimum Cost To Connect Sticks Rust
1180๐Ÿ”’ Count Substrings with Only One Distinct Letter Rust
1207 Unique Number of Occurrences Rust
1213๐Ÿ”’ Intersection of Three Sorted Arrays Rust
1226 The Dining Philosophers C++
1227 Airplane Seat Assignment Probability Python
1232 Check If It Is a Straight Line Rust
1248 Count Number of Nice Subarrays Rust
1251๐Ÿ”’ Average Selling Price SQL
1252 Cells with Odd Values in a Matrix Rust
1265๐Ÿ”’ Print Immutable Linked List in Reverse C
1266 Minimum Time Visiting All Points Rust
1281 Subtract the Product and Sum of Digits of an Integer Python
1295 Find Numbers with Even Number of Digits Rust
1299 Replace Elements with Greatest Element on Right Side Rust
1303๐Ÿ”’ Find the Team Size SQL
1313 Decompress Run-Length Encoded List Python
1329 Sort The Matrix Diagonally Rust
1342 Number of Steps to Reduce a Number to Zero Rust
1346 Check If N and Its Double Exist Rust
1351 Count Negative Numbers in a Sorted Matrix Rust
1356 Sort Integers by The Number of 1 Bits Rust
1365 How Many Numbers Are Smaller Than the Current Number Rust
1370 Increasing Decreasing String Rust
1374 Generate a String With Characters That Have Odd Counts Rust
1379 Find a Corresponding Node of a Binary Tree ... Python
1380 Lucky Numbers in a Matrix Rust
1389 Create Target Array in the Given Order Rust
1395 Count Number of Teams Rust
1409 Queries on a Permutation With Key Rust
1429๐Ÿ”’ First Unique Number Python
1431 Kids With the Greatest Number of Candies Rust
1436 Destination City Rust
1445๐Ÿ”’ Apples Oranges SQL
1450 Number of Students Doing Homework at ... Rust
1464 Maximum Product of Two Elements in an Array Rust
1470 Shuffle the Array Rust
1475 Final Prices With a Special Discount... Rust
1476 Subrectangle Queries Python
1480 Running Sum of 1d Array Rust
1486 XOR Operation in an Array Rust, Racket
1502 Can Make Arithmetic Progression From Sequence Rust
1512 Number of Good Pairs Rust
1528 Shuffle String Rust
1534 Count Good Triplets Rust
1551 Minimum Operations to Make Array Equal Rust
1570 Dot Product of Two Sparse Vectors Rust
1572 Matrix Diagonal Sum Rust
1576 Replace All ?'s to Avoid Consecutive ... Rust
1577 Number of Ways Where Square of ... Rust
1578 Minimum Deletion Cost to Avoid Repeating ... Rust
1582 Special Positions in a Binary Matrix Rust
1584 Min Cost to Connect All Points Rust
1588 Sum of All Odd Length Subarrays Rust
1601 Design Parking System Rust
1614 Maximum Nesting Depth of the Parentheses Rust
1636 Sort Array by Increasing Frequency Rust
1637 Widest Vertical Area Between Two Points ... Rust
1640 Check Array Formation Through Concatenation Rust
1656 Design an Ordered Stream Rust
1658 Defuse The Bomb Rust
1662 Check If Two String Arrays are Equivalent Rust
1672 Richest Customer Wealth Rust
1678 Goal Parser Interpretation Rust
1683๐Ÿ”’ Invalid Tweets SQL
1684 Count the Number of Consistent Strings Rust
1688 Count of Matches in Tournament Rust
1694 Reformat Phone Number Rust
1700 Number of Students Unable to Eat Lunch Rust
1710 Maximum Units on a Truck Rust
1711 Count Good Meals Rust
1716 Calculate Money in Leetcode Bank Rust
1720 Decode XORed Array Rust
1725 Number Of Rectangles That Can ... Rust
1732 Find the Highest Altitude Rust
1741๐Ÿ”’ Find Total Time Spent by Each Employee SQL
1748 Sum of Unique Elements Rust
1752 Check if Array Is Sorted and Rotated Rust
1753 Maximum Score From Removing Stones Rust
1754 Largest Merge Of Two Strings Rust
1790 Check if One String Swap Can Make Strings Equal Rust
1816 Truncate Sentence Rust
1834 Single Threaded Cpu Rust
1837 Sum of Digits in Base K Rust
1839 Longest Substring Of All Vowels in Order Rust

ๅ‰‘ๆŒ‡Offer(lcof)

# Title Solutions Category
59 ้˜Ÿๅˆ—็š„ๆœ€ๅคงๅ€ผ Python
60 nไธช้ชฐๅญ็š„็‚นๆ•ฐ Python
61 ๆ‰‘ๅ…‹็‰Œไธญ็š„้กบๅญ Python
62 ๅœ†ๅœˆไธญๆœ€ๅŽๅ‰ฉไธ‹็š„ๆ•ฐๅญ— Python ็บฆ็‘Ÿๅคซ็Žฏ

TODO:

  • 43/415 ๅญ—็ฌฆไธฒๆ•ดๆ•ฐ็›ธไน˜/็›ธๅŠ 
  • 415ๆ˜ฏ็ปๅ…ธ้ข่ฏ•้ข˜ๅˆฉ็”จๅญ—็ฌฆไธฒๆจกๆ‹Ÿ็ซ–ๅผๅŠ ๆณ•่ฟ›่กŒๅคงๆ•ฐ็›ธๅŠ 
  • ๆœ‰ๅ…ด่ถฃไฝ†ๆ˜ฏๅ›ฐ้šพ็บงๅˆซ็š„้ข˜: 1. ๆŽจ็ฎฑๅญ 2. ๅŽๅฎน้“

ๆœ‰ๆ„ๆ€็š„ไฝ†ๆ˜ฏๆฒกๆœ‰ๆ‰พๅˆฐ้ข˜ๅท็š„้—ฎ้ข˜:

  1. ๆตท็›—ๅˆ†้‡‘ๅธ้—ฎ้ข˜(ๆฏ”่พƒ่„‘็ญ‹ๆ€ฅ่ฝฌๅผฏ็š„้€’ๆŽจ)
  2. ๆœ€ๅคง็›ดๆ–นๅ›พ็Ÿฉ้˜ต(Longest Histogram Rectangle), ๅ•่ฐƒๆ ˆO(n^3)->O(n)

lintcode_problems

# Title Solutions Category
1 A + B Problem leetcode_372
2 Trailing Zeros leetcode_172
3 Digit Counts Python
4 Ugly Number II leetcode_264
5 Kth Largest Element Python quick_select, heap
6 Merge Two Sorted Arrays leetcode_88
7 Serialize and Deserialize Binary Tree leetcode_297
8 Rotate String leetcode_796
9 Fizz Buzz leetcode_412
10 String Permutation II Python backtracking
11 Search Range in Binary Search Tree leetcode_938
12 Min Stack leetcode_155
13 Implement strStr() leetcode_28
14 First Position of Target leetcode_34
15 Permutations leetcode_46
16 Permutations II leetcode_47
17 Subsets leetcode_78
18 Subsets II leetcode_90
20 Dices Sum Python
22 Flatten List leetcode_314
28 Search a 2D Matrix leetcode_74
31 Partition Array Python two_pointers
33 N Queens leetcode_51
34 N Queens II leetcode_52
35 Reverse Linked List leetcode_206
36 Reverse Linked List II leetcode_92
38 Search a 2D Matrix II leetcode_240
40 Implement Queue by Two Stacks Python
41 Maximum Subarray Python greedy, dp
46 Majority Element leetcode_169
49 Sort Letters by Case Python
50 Product of Array Exclude Itself leetcode_lcof_66
52 Next Permutation Python
53 Reverse Words in a String leetcode_151
56 Two Sum leetcode_1
57 3Sum leetcode_15
58 4Sum leetcode_18
59 3Sum Closest leetcode_16
60 Search Insert Position leetcode_35
61 Search for a Range leetcode_34
62 Search in Rotated Sorted Array leetcode_33
63 Search in Rotated Sorted Array II leetcode_81
64 Merge Sorted Array leetcode_88
65 Median of Two Sorted Arrays leetcode_4
66 Binary Tree Preorder Traversal leetcode_144
67 Binary Tree Inorder Traversal leetcode_94
68 Binary Tree Postorder Traversal leetcode_145
69 Binary Tree Level Order Traversal leetcode_102
70 Binary Tree Level Order Traversal II leetcode_102
71 Binary Tree Zigzag Level Order Traversal leetcode_103
72 Construct Binary Tree from Inorder and Postorder Traversal leetcode_106
73 Construct Binary Tree from Preorder and Inorder Traversal leetcode_105
74 First Bad Version leetcode_278
75 Find Peak Element leetcode_825
76 Longest Increasing Subsequence Python ๆŽฅ้พ™ๅž‹ๅŠจๆ€่ง„ๅˆ’
77 Longest Common Subsequence Python
78 Longest Common Prefix leetcode_14
79 Longest Common Substring Python
80 Median Python quick_select
82 Single Number leetcode_136
83 Single Number II leetcode_137
84 Single Number III leetcode_260
86 Binary Search Tree Iterator Python
88 Lowest Common Ancestor of a Binary Tree Python divide_and_conquer
90 k Sum II Python
92 Backpack Python
93 Balanced Binary Tree Python divide_and_conquer
94 Binary Tree Maximum Path Sum Python
95 Validate Binary Search Tree Python
96 Partition List leetcode_86
97 Maximum Depth of Binary Tree Python
98 Sort List leetcode_148
100 Remove Duplicates from Sorted Array leetcode_26
102 Linked List Cycle leetcode_141
103 Linked List Cycle II leetcode_142
104 Merge k Sorted Lists leetcode_23
105 Copy List with Random Pointer Python
106 Convert Sorted List to Binary Search Tree Python divide_and_conquer
107 Word Break Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
109 Triangle leetcode_120
110 Minimum Path Sum Python
112 Remove Duplicates from Sorted List C++
113 Remove Duplicates from Sorted List II C++
114 Unique Paths leetcode_62
115 Unique Paths II Python
120 Word Ladder Python ๅŒๅ‘BFS
121 Word Ladder II Python BFS+DFS
123 Word Search Python
124 Longest Consecutive Sequence Python ๅนถๆŸฅ้›†
125 Backpack II Python
127 Topological Sorting Python BFS, topological_sorting
128 Hash Function Python
129 Rehashing Python
132 Word Search II Python ๅ‰็ผ€ๆ ‘
134 LRU Cache Python double_linked_list, OrderedDict
135 Combination Sum Python, Rust
137 Clone Graph Python DFS, BFS
138 Subarray Sum Python
140 Fast Power leetcode_50
141 Sqrt(x) leetcode_69
142 O(1) Check Power of 2 leetcode_231
143 Sort Colors II Python quick_sort, counting_sort
144 interleaving_positive_and_negative_numbers Python
145 Lower case to Uppercase leetcode_709
147๐Ÿ”’ Narcissistic Number Python
148 Sort Colors Python three_pointers, partition_array
149 Best Time to Buy and Sell Stock leetcode_121
150 Best Time to Buy and Sell Stock II leetcode_122
151 Best Time to Buy and Sell Stock III leetcode_123
152 Combinations leetcode_77
153 Combination Sum II Python, Rust
154 Regular Expression Matching leetcode_10
155 Minimum Depth of Binary Tree leetcode_111
158 Valid Anagram leetcode_242
159 Find Minimum in Rotated Sorted Array leetcode_153
160 Find Minimum in Rotated Sorted Array II Python binary_search
161 Rotate Image Rust
162 Set Matrix Zeroes leetcode_73
165 Merge Two Sorted Lists leetcode_21
166 Nth to Last Node in List leetcode_19
167 Add Two Numbers leetcode_2
168 Burst Balloons Python
171 Anagrams Python
172 Remove Element leetcode_27
173 Insertion Sort List leetcode_147
174 Remove Nth Node From End of List leetcode_19
175 Invert Binary Tree leetcode_226
177 Convert Sorted Array to Binary Search Tree With Minimal Height Python divide_and_conquer
181 Flip Bits leetcode_461
183 Wood Cut Python greedy
187 Gas Station leetcode_134
190 Next Permutation II Python
192 Wildcard Matching Python
197 Permutation Index Python
200 Longest Palindromic Substring leetcode_5
209 First Unique Character in a String leetcode_387
211 String Permutation Python
235 Prime Factorization Python ๅˆ†่งฃ่ดจๅ› ๆ•ฐ
241๐Ÿ”’ String to Integer (atoi) leetcode_8
249 Count of Smaller Number before itself Python sqrt_n
254 Drop Eggs Python sqrt_n
272๐Ÿ”’ Climbing Stairs II Python
298 Find Primes leetcode_204
309 Interleaved Array
328 String Partition leetcode_763
334 Order Check leetcode_1051
363 Trapping Rain Water leetcode_42
366 Fibonacci leetcode_509
372 Delete Node in a Linked List leetcode_237
373 Partition Array by Odd and Even leetcode_905
374 Spiral Matrix leetcode_54
376 Binary Tree Path Sum Python DFS, backtracking
380 Intersection of Two Linked Lists Python
381 Spiral Matrix II leetcode_59
382๐Ÿ”’ Triangle Count leetcode_611
383 Container With Most Water leetcode_11
384 Longest Substring Without Repeating Characters leetcode_3
386 Longest Substring with At Most K Distinct Characters Python
388 Permutation Sequence Python
389 Valid Sudoku leetcode_36
392 House Robber Python
393 Best Time to Buy and Sell Stock IV Python
397 Longest Continuous Increasing Subsequence Python
400 Maximum Gap leetcode_164
406 Minimum Size Subarray Sum Python sliding_window
407 Plus One leetcode_66
408 Add Binary leetcode_67
411 Gray Code leetcode_89
412 Candy leetcode_135
415 Valid Palindrome Python two_pointers
417 Valid number leetcode_65
418 Integer to Roman leetcode_12
419 Roman to Integer leetcode_13
420 Count And Say leetcode_38
423 Valid Parentheses leetcode_20
425 Letter Combinations of a Phone Number leetcode_17
426 Restore IP Addresses leetcode_93
427 Generate Parentheses leetcode_22
428 Pow(x, n) leetcode_50
433 Number of Islands Python special_data_structure.union_find, DFS, BFS
437 Copy Books Python dp, binary_search
440๐Ÿ”’ Backpack III Python
443๐Ÿ”’ Two Sum - Greater than target Python two_pointers
447๐Ÿ”’ Search in a Big Sorted Array Python binary_search_first, ๅ€ๅขžๆณ•
451 Swap Nodes in Pairs leetcode_24
452 Remove Linked List Elements leetcode_203
453 Flatten Binary Tree to Linked List Python
457 Classical Binary Search Python binary_search
458 Last Position of Target leetcode_34
460 Find K Closest Elements leetcode_658
461 Kth Smallest Numbers in Unsorted Array Python
462 Total Occurrence of Target leetcode_34
464 Sort Integers II Python
466 Count Linked List Nodes too_easy
474๐Ÿ”’ Lowest Common Ancestor II Python
476 Stone Game(diff to leetcode) Python
480 Binary Tree Paths Python DFS, backtracking
486 Merge K Sorted Arrays Python
488 Happy Number leetcode_202
491 Palindromic Number leetcode_9
492 Implement Queue by Linked List Python
494 Implement Stack by Two Queues Python
495 Implement Stack Python
512 Decode Ways Python
513 Perfect Squares Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
517 Ugly Number leetcode_263
521๐Ÿ”’ Remove Duplicate Numbers in Array Python partition_array
533๐Ÿ”’ Two Sum - Closest to target Python two_sum
534 House Robber II leetcode_213
535 House Robber III leetcode_337
539 Move Zeros leetcode_283
544 Top k Largest Numbers Python min_heap
545 Top k Largest Numbers II Python min_heap
547 Intersection of Two Arrays Python
548 Intersection of Two Arrays II Python
562 Backpack IV Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
564 Combination Sum IV Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
563 Backpack V Python
577 Merge k Sorted Interval Lists Python
578 Lowest Common Ancestor III Python
582 Word Break II Python
584 Drop Eggs II Rust dp
585๐Ÿ”’ Maximum Number in Mountain Sequence Python mountain_array, binary_search
586๐Ÿ”’ Sqrt(x) II leetcode_69
587๐Ÿ”’ Two Sum - Unique pairs Python two_sum
588 Partition Equal Subset Sum Python 0-1่ƒŒๅŒ…้—ฎ้ข˜
594 Implement strStr() II Python kmp, Rabin-Karp(rolling_hash)
596๐Ÿ”’ Minimum Subtree Python divide_and_conquer
600 Smallest Rectangle Enclosing Black Pixels Python
603 Largest Divisible Subset Python
606 Kth Largest Element II Python quick_select, quick_sort, heap
607 Two Sum III - Data structure design Python two_pointers
608 Two Sum II - Input array is sorted Python two_pointers
609 Two Sum - Less than or equal to target Python two_pointers
610 Two Sum - Difference equals to target Python two_pointers
611๐Ÿ”’ Knight Shortest Path Python bfs
612๐Ÿ”’ K Closest Points leetcode_973
615 Course Schedule Python BFS, topological_sorting
616 Course Schedule II Python BFS, topological_sorting
627 Longest Palindromic Combination Python greedy
628 Maximum Subtree Python divide_and_conquer
630๐Ÿ”’ Knight Shortest Path II Python bfs
633 Find the Duplicate Number Python ๅฟซๆ…ขๅŒๆŒ‡้’ˆ
654 Sparse Matrix Multiplication leetcode_311
655 Add String C++
657 Insert Delete GetRandom O(1) Python
661 Convert BST to Greater Tree Python
667 Longest Palindromic Subsequence Python dp(greedy)
668 Ones and Zeroes leetcode_474
669 Coin Change Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
683 Word Break III Python
685 First Unique Number in Data Stream Python
689 First Unique Number in Data Stream Python
691 Recover Binary Search Tree Python
701 Trim A Binary Search Tree Python
702 Russian Doll Envelopes Python
719 Calculate Maximum Value Python
724 Minimum Partition Python 0-1่ƒŒๅŒ…้—ฎ้ข˜
740 Coin Change 2 Python ๅฎŒๅ…จ่ƒŒๅŒ…้—ฎ้ข˜
741 Calculate Maximum Value II Python
742 Self Dividing Numbers leetcode_728
749 John's backyard garden Python
761 Smallest Subset Python
769 Spiral Array leetcode_59
772 Group Anagrams leetcode_49
773 Valid Anagram leetcode_242
777 Valid Perfect Square leetcode_367
787 The Maze leetcode_490
793 Intersection of Arrays Python
802 Soduku Solver Python
813 Find Anagram Mappings leetcode_760
816 Traveling Salesman Problem Python
828 Word Pattern Python
829 Word Pattern II Python DFS
835 Hamming Distance leetcode_461
839 Merge Two Sorted Interval Lists Python
840 Range Sum Query - Mutable leetcode_307
841 String Replace Python
845 Greatest Common Divisor Python
859 Max Stack Python
871 Minimum Factorization Python greedy
880 Construct Binary Tree from String Python
891 Valid Palindrome II Python two_pointers, greedy
892 Alien Dictionary Python heapq, topological_sorting
900 Closest Binary Search Tree Value Python
901 Closest Binary Search Tree Value II Python
902 Kth Smallest Element in a BST Python DFS, stack
904 Plus One Linked List leetcode_369
916 Palindrome Permutation leetcode_266
943 Range Sum Query - Immutable leetcode_303
954 Insert Delete GetRandom O(1) - Duplicates allowed Python
955 Implement Queue by Circular Array Python
973 1-bit and 2-bit Characters leetcode_713
975 2 Keys Keyboard leetcode_650
976 4Sum II leetcode_454
982 Arithmetic Slices leetcode_413
995 Best Time ... Stock with Cooldown Python
1000 Best Time ... Stock with ... Fee leetcode_714
1010 Max Increase to Keep City Skyline leetcode_807
1028 Rotated Digits leetcode_788
1038 Jewels and Stones leetcode_771
1054 Min Cost Climbing Stairs leetcode_746
1057 Network Delay Time leetcode_743
1079 Count Binary Substrings leetcode_696
1115 Average of Levels in Binary Tree leetcode_633
1137 Construct String from Binary Tree leetcode_606
1147 Work Plan Python
1162 Merge Two Binary Trees Python
1173 Reverse Words in a String III leetcode_567
1179๐Ÿ”’ Friend Circles leetcode_547
1186 Encode and Decode TinyURL leetcode_535
1199 Perfect Number leetcode_507
1080 Max Area of Island leetcode_695
1138 Can Place Flowers leetcode_605
1196 Freedom Trail leetcode_514
1201 Next Greater Element II leetcode_503
1205 Diagonal Traverse leetcode_498
1208 Target Sum Python 0-1่ƒŒๅŒ…้—ฎ้ข˜
1212 Max Consecutive Ones leetcode_485
1222 Validate IP Address leetcode_486
1225 Island Perimeter leetcode_463
1230 Assign Cookies leetcode_455
1235 Serialize and Deserialize BST leetcode_449
1246 Longest Repeating Character Replacement leetcode_426
1252 Queue Reconstruction by Height leetcode_406
1254 Sum of Left Leaves Python
1266 Find The Difference leetcode_389
386 Lexicographical Numbers leetcode_386
1276 Sum of Two Integers Python binary_addition
1283 Reverse String leetcode_344
1284 Integer Break Python ๅˆ’ๅˆ†็ฑปDP
1292 Odd Even Linked List leetcode_328
1300 Bash Game(Nim Game) leetcode_292
1311 Lowest Common Ancestor of a Binary Search Tree Python
1317 Count Complete Tree Nodes leetcode_222
1319 Contains Duplicate II leetcode_219
1320 Contains Duplicate leetcode_217
1324 Count Primes leetcode_204
1321๐Ÿ”’ Combination Sum III leetcode_216
1333 Reverse Bits leetcode_190
1334 Rotate Array leetcode_189
1343 Sum of Two Strings Python
1354 Pascals Triangle II leetcode_119
1355 Pascals Triangle leetcode_118
1359 Convert Sorted Array to Binary Search Tree Python divide_and_conquer
1363 ZigZag Conversion leetcode_6
1375 Substring With At Least K Distinct Characters Python
1424 Longest Mountain in Array leetcode_845
1428 Keys and Rooms leetcode_841
1438 Positions of Large Groups leetcode_830
1479 Can Reach The Endpoint Python bfs
1492 Koko Eating Bananas leetcode_875
1499 Reordered Power of 2 Python permutation
1508 Score After Flipping Matrix Python greedy
1509 Lemonade Change Rust
1524 Search in a Binary Search Tree leetcode_700
1525 N-ary Tree Postorder Traversal Python
1529 N-ary Tree Preorder Traversal Python
1533 N-ary Tree Level Order Traversal leetcode_429
1536 Find First and Last Position of Element ... leetcode_34
1593 Construct Binary Tree from Preorder and Postorder ... Python DFS
1609 Middle of the Linked List leetcode_228
1704 Range Sum of BST leetcode_938
1790๐Ÿ”’ Rotate String II Python reverse, circle_shift
1848_FAILED Word Search III Python
1870 number of substrings with all zeroes Python
1872 Minimum Cost To Connect Sticks leetcode_1167
1876 Alien Dictionary(easy) Python
1901 Squares of a Sorted Array leetcode_977

ๅˆ’ๅˆ†ๅž‹ๅŠจๆ€่ง„ๅˆ’

ๆˆณๆฐ”็ƒใ€็Ÿณๅญๅฝ’ๅนถ(dp/stone_game_merge.py)

้€‰ๆˆ–ไธ้€‰็ฑปDP

  • ๆ‰“ๅฎถๅŠซ่ˆ็ณปๅˆ—
  • ่‚ก็ฅจไนฐๅ–็ณปๅˆ—

TODO ่ฎกๆ•ฐๅž‹ๅŠจๆ€่ง„ๅˆ’ k sum

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.