Skip to content

python刷leetcode记录。项目含有详细的代码注释和解题思路,并配有对应的leetcode中英文题目。The project contains detailed code comments and solution ideas(chinese), and has corresponding leetcode question content(Chinese and English).

License

Notifications You must be signed in to change notification settings

yatengLG/leetcode-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leet Code

English | 中文版

finished 249/2342

Easy: 87 Medium: 143 Hard: 19

Every time a new code is added, the corresponding question will be added.

Project update from time to time, strive to update every day .

WelcomeGitHub stars GitHub forks

Explain

The project is a record of the author's leetcode.

The project is continuously updated.

Project structure

    |-- README.md
    |-- question_bank
        |-- question1
            |-- question1.py     # code
            |-- question1.md     # question
        |-- question2
            |-- question2.py
            |-- question2.md
        ……

Question Bank

ID question Diffculty Pass rate Code
1 Two Sum Easy 0.52 🔗c++🔗python
2 Add Two Numbers Medium 0.41 🔗python
3 Longest Substring Without Repeating Characters Medium 0.38 🔗python
4 Median of Two Sorted Arrays Hard 0.41 🔗python
5 Longest Palindromic Substring Medium 0.35 🔗python
6 ZigZag Conversion Medium 0.51 🔗python
7 Reverse Integer Easy 0.35 🔗python
8 String to Integer (atoi) Medium 0.22 🔗python
9 Palindrome Number Easy 0.59 🔗python
10 Regular Expression Matching Hard 0.32 🔗python
11 Container With Most Water Medium 0.63 🔗python
12 Integer to Roman Medium 0.67 🔗python
13 Roman to Integer Easy 0.63 🔗python
14 Longest Common Prefix Easy 0.41 🔗python
15 3Sum Medium 0.33 🔗python
16 3Sum Closest Medium 0.46 🔗python
17 Letter Combinations of a Phone Number Medium 0.57 🔗python
18 4Sum Medium 0.40 🔗python
19 Remove Nth Node From End of List Medium 0.43 🔗python
20 Valid Parentheses Easy 0.44 🔗python
21 Merge Two Sorted Lists Easy 0.67 🔗python
22 Generate Parentheses Medium 0.77 🔗python
24 Swap Nodes in Pairs Medium 0.70 🔗python
26 Remove Duplicates from Sorted Array Easy 0.54 🔗python
27 Remove Element Easy 0.60 🔗python
28 Implement strStr() Easy 0.41 🔗python
31 Next Permutation Medium 0.37 ✔️
32 Longest Valid Parentheses Hard 0.36 🔗python
34 Find First and Last Position of Element in Sorted Array Medium 0.42 🔗python
35 Search Insert Position Easy 0.47 🔗python
37 Sudoku Solver Hard 0.67 🔗python
38 Count and Say Medium 0.58 🔗python
39 Combination Sum Medium 0.73 🔗python
40 Combination Sum II Medium 0.63 🔗python
43 Multiply Strings Medium 0.45 🔗python
44 Wildcard Matching Hard 0.33 🔗python
46 Permutations Medium 0.78 🔗python
47 Permutations II Medium 0.64 🔗python
51 N-Queens Hard 0.74 🔗python
52 N-Queens II Hard 0.82 🔗python
53 Maximum Subarray Easy 0.55 🔗python
55 Jump Game Medium 0.43 🔗python
57 Insert Interval Medium 0.41 🔗python
58 Length of Last Word Easy 0.35 🔗python
60 Permutation Sequence Hard 0.52 🔗python
61 Rotate List Medium 0.42 🔗python
62 Unique Paths Medium 0.66 🔗python
63 Unique Paths II Medium 0.39 🔗python
64 Minimum Path Sum Medium 0.69 🔗python
66 Plus One Easy 0.46 🔗python
70 Climbing Stairs Easy 0.53 🔗python
71 Simplify Path Medium 0.42 🔗python
72 Edit Distance Hard 0.61 🔗python
75 Sort Colors Medium 0.59 🔗python
77 Combinations Medium 0.77 🔗python
78 Subsets Medium 0.80 🔗python
79 Word Search Medium 0.46 🔗python
82 Remove Duplicates from Sorted List II Medium 0.53 🔗python
83 Remove Duplicates from Sorted List Easy 0.54 🔗python
86 Partition List Medium 0.63 🔗python
89 Gray Code Medium 0.71 🔗python
90 Subsets II Medium 0.63 🔗python
91 Decode Ways Medium 0.31 🔗python
92 Reverse Linked List II Medium 0.55 🔗python
93 Restore IP Addresses Medium 0.54 🔗python
94 Binary Tree Inorder Traversal Easy 0.76 🔗python
96 Unique Binary Search Trees Medium 0.70 🔗python
103 Binary Tree Zigzag Level Order Traversal Medium 0.57 🔗python
104 Maximum Depth of Binary Tree Easy 0.77 🔗python
106 Construct Binary Tree from Inorder and Postorder Traversal Medium 0.72 🔗python
107 Binary Tree Level Order Traversal II Medium 0.70 🔗python
109 Convert Sorted List to Binary Search Tree Medium 0.76 🔗python
110 Balanced Binary Tree Easy 0.56 🔗python
111 Minimum Depth of Binary Tree Easy 0.48 🔗python
112 Path Sum Easy 0.53 🔗python
113 Path Sum II Medium 0.63 🔗python
116 Populating Next Right Pointers in Each Node Medium 0.70 🔗python
117 Populating Next Right Pointers in Each Node II Medium 0.61 🔗python
118 Pascal's Triangle Easy 0.73 🔗python
120 Triangle Medium 0.68 🔗python
121 Best Time to Buy and Sell Stock Easy 0.57 🔗python
122 Best Time to Buy and Sell Stock II Medium 0.69 🔗python
127 Word Ladder Hard 0.47 🔗python
129 Sum Root to Leaf Numbers Medium 0.68 🔗python
131 Palindrome Partitioning Medium 0.72 🔗python
134 Gas Station Medium 0.58 🔗python
136 Single Number Easy 0.72 🔗python
137 Single Number II Medium 0.72 🔗python
138 Copy List with Random Pointer Medium 0.66 🔗python
139 Word Break Medium 0.51 🔗python
141 Linked List Cycle Easy 0.51 🔗python
142 Linked List Cycle II Medium 0.55 🔗python
143 Reorder List Medium 0.62 🔗python
144 Binary Tree Preorder Traversal Easy 0.70 🔗python
145 Binary Tree Postorder Traversal Easy 0.75 🔗python
147 Insertion Sort List Medium 0.68 🔗python
150 Evaluate Reverse Polish Notation Medium 0.54 🔗python
152 Maximum Product Subarray Medium 0.42 🔗python
164 Maximum Gap Hard 0.61 ✔️
169 Majority Element Easy 0.66 🔗python
198 House Robber Medium 0.51 🔗python
204 Count Primes Easy 0.38 🔗python
213 House Robber II Medium 0.43 🔗python
215 Kth Largest Element in an Array Medium 0.65 🔗python
216 Combination Sum III Medium 0.74 🔗python
221 Maximal Square Medium 0.47 🔗python
222 Count Complete Tree Nodes Medium 0.78 🔗python
226 Invert Binary Tree Easy 0.79 🔗python
234 Palindrome Linked List Easy 0.49 🔗python
235 Lowest Common Ancestor of a Binary Search Tree Easy 0.67 🔗python
236 Lowest Common Ancestor of a Binary Tree Medium 0.68 🔗python
237 Delete Node in a Linked List Easy 0.85 🔗python
257 Binary Tree Paths Easy 0.68 🔗python
264 Ugly Number II Medium 0.58 🔗python
279 Perfect Squares Medium 0.63 🔗python
283 Move Zeroes Easy 0.64 🔗python
300 Longest Increasing Subsequence Medium 0.51 🔗python
303 Range Sum Query - Immutable Easy 0.72 🔗python
304 Range Sum Query 2D - Immutable Medium 0.54 🔗python
306 Additive Number Medium 0.34 🔗python
309 Best Time to Buy and Sell Stock with Cooldown Medium 0.61 🔗python
316 Remove Duplicate Letters Medium 0.48 🔗python
322 Coin Change Medium 0.44 🔗python
327 Count of Range Sum Hard 0.42 ✔️
328 Odd Even Linked List Medium 0.66 🔗python
331 Verify Preorder Serialization of a Binary Tree Medium 0.48 🔗python
332 Reconstruct Itinerary Medium 0.45 🔗python
338 Counting Bits Easy 0.79 🔗python
343 Integer Break Medium 0.60 🔗python
344 Reverse String Easy 0.77 🔗python
347 Top K Frequent Elements Medium 0.62 🔗python
349 Intersection of Two Arrays Easy 0.74 🔗python
357 Count Numbers with Unique Digits Medium 0.52 🔗python
368 Largest Divisible Subset Medium 0.46 🔗python
371 Sum of Two Integers Medium 0.58 ✔️
375 Guess Number Higher or Lower II Medium 0.47 🔗python
376 Wiggle Subsequence Medium 0.46 🔗python
377 Combination Sum IV Medium 0.51 🔗python
381 Insert Delete GetRandom O(1) - Duplicates allowed Hard 0.44 ✔️
392 Is Subsequence Easy 0.51 🔗python
394 Decode String Medium 0.55 🔗python
401 Binary Watch Easy 0.61 🔗python
402 Remove K Digits Medium 0.33 🔗python
404 Sum of Left Leaves Easy 0.58 🔗python
406 Queue Reconstruction by Height Medium 0.74 🔗python
416 Partition Equal Subset Sum Medium 0.51 🔗python
435 Non-overlapping Intervals Medium 0.51 🔗python
445 Add Two Numbers II Medium 0.59 🔗python
452 Minimum Number of Arrows to Burst Balloons Medium 0.51 🔗python
454 4Sum II Medium 0.60 ✔️
459 Repeated Substring Pattern Easy 0.51 🔗python
463 Island Perimeter Easy 0.71 🔗python
486 Predict the Winner Medium 0.59 🔗python
491 Increasing Subsequences Medium 0.55 🔗python
501 Find Mode in Binary Search Tree Easy 0.51 🔗python
504 Base 7 Easy 0.50 🔗python
514 Freedom Trail Hard 0.50 ✔️
526 Beautiful Arrangement Medium 0.73 🔗python
529 Minesweeper Medium 0.65 🔗python
530 Minimum Absolute Difference in BST Easy 0.62 🔗python
538 Convert BST to Greater Tree Medium 0.70 🔗python
557 Reverse Words in a String III Easy 0.75 🔗python
606 Construct String from Binary Tree Easy 0.57 🔗python
617 Merge Two Binary Trees Easy 0.79 🔗python
621 Task Scheduler Medium 0.57 🔗python
637 Average of Levels in Binary Tree Easy 0.69 🔗python
647 Palindromic Substrings Medium 0.66 🔗python
649 Dota2 Senate Medium 0.48 🔗python
657 Robot Return to Origin Easy 0.78 🔗python
659 Split Array into Consecutive Subsequences Medium 0.54 🔗python
682 Baseball Game Easy 0.70 🔗python
685 Redundant Connection II Hard 0.43 🔗python
714 Best Time to Buy and Sell Stock with Transaction Fee Medium 0.72 🔗python
725 Split Linked List in Parts Medium 0.56 🔗python
733 Flood Fill Easy 0.58 🔗python
738 Monotone Increasing Digits Medium 0.50 🔗python
746 Min Cost Climbing Stairs Easy 0.58 🔗python
430 Flatten a Multilevel Doubly Linked List Medium 0.54 🔗python
763 Partition Labels Medium 0.76 🔗python
589 N-ary Tree Preorder Traversal Easy 0.75 🔗python
767 Reorganize String Medium 0.48 🔗python
771 Jewels and Stones Easy 0.85 🔗python
701 Insert into a Binary Search Tree Medium 0.72 🔗python
784 Letter Case Permutation Medium 0.68 🔗python
817 Linked List Components Medium 0.59 🔗python
834 Sum of Distances in Tree Hard 0.53 ✔️
841 Keys and Rooms Medium 0.66 🔗python
842 Split Array into Fibonacci Sequence Medium 0.49 🔗python
844 Backspace String Compare Easy 0.51 🔗python
845 Longest Mountain in Array Medium 0.42 🔗python
860 Lemonade Change Easy 0.59 🔗python
861 Score After Flipping Matrix Medium 0.81 🔗python
876 Middle of the Linked List Easy 0.71 🔗python
897 Increasing Order Search Tree Easy 0.75 🔗python
921 Minimum Add to Make Parentheses Valid Medium 0.74 🔗python
922 Sort Array By Parity II Easy 0.71 🔗python
925 Long Pressed Name Easy 0.39 🔗python
941 Valid Mountain Array Easy 0.39 🔗python
942 DI String Match Easy 0.73 🔗python
968 Binary Tree Cameras Hard 0.50 🔗python
973 K Closest Points to Origin Medium 0.64 🔗python
977 Squares of a Sorted Array Easy 0.72 🔗python
993 Cousins in Binary Tree Easy 0.56 🔗python
994 Rotting Oranges Medium 0.51 🔗python
996 Number of Squareful Arrays Hard 0.50 🔗python
1002 Find Common Characters Easy 0.74 🔗python
1024 Video Stitching Medium 0.56 🔗python
1025 Divisor Game Easy 0.71 🔗python
1030 Matrix Cells in Distance Order Easy 0.71 🔗python
1079 Letter Tile Possibilities Medium 0.74 🔗python
1111 Maximum Nesting Depth of Two Valid Parentheses Strings Medium 0.77 🔗python
1291 Sequential Digits Medium 0.52 🔗python
1122 Relative Sort Array Easy 0.71 🔗python
1171 Remove Zero Sum Consecutive Nodes from Linked List Medium 0.47 🔗python
1184 Distance Between Bus Stops Easy 0.59 🔗python
1185 Day of the Week Easy 0.61 🔗python
1207 Unique Number of Occurrences Easy 0.73 🔗python
1219 Path with Maximum Gold Medium 0.63 ✔️
1239 Maximum Length of a Concatenated String with Unique Characters Medium 0.49 🔗python
1282 Group the People Given the Group Size They Belong To Medium 0.81 🔗python
1310 XOR Queries of a Subarray Medium 0.71 🔗python
1356 Sort Integers by The Number of 1 Bits Easy 0.73 🔗python
1357 Apply Discount Every n Orders Medium 0.53 🔗python
1370 Increasing Decreasing String Easy 0.79 🔗python
1365 How Many Numbers Are Smaller Than the Current Number Easy 0.83 🔗python
1367 Linked List in Binary Tree Medium 0.42 🔗python
1415 The k-th Lexicographical String of All Happy Strings of Length n Medium 0.68 🔗python
1441 Build an Array With Stack Operations Easy 0.65 🔗python
1566 Detect Pattern of Length M Repeated K or More Times Easy 0.45 🔗python
1588 Sum of All Odd Length Subarrays Easy 0.84 🔗python
1605 Find Valid Matrix Given Row and Column Sums Medium 0.74 🔗python
1593 Split a String Into the Max Number of Unique Substrings Medium 0.53 🔗python
面试题 05.06 Convert Integer LCCI Easy 0.53 🔗python
面试题 02.05 Sum Lists LCCI Medium 0.47 🔗python
面试题 08.01 Three Steps Problem LCCI Easy 0.36 🔗python
面试题 08.04 Power Set LCCI Medium 0.82 🔗python
面试题 08.09 Bracket LCCI Medium 0.81 🔗python
面试题 08.12 Eight Queens LCCI Hard 0.76 🔗python
面试题 08.07 Permutation I LCCI Medium 0.81 🔗python
剑指 Offer 20 表示数值的字符串 LCOF Medium 0.24 🔗python
剑指 Offer 42 连续子数组的最大和 LCOF Easy 0.61 🔗python
剑指 Offer 38 字符串的排列 LCOF Medium 0.58 🔗python
剑指 Offer 32 - II 从上到下打印二叉树 II LCOF Easy 0.69 🔗python
面试题 08.08 Permutation II LCCI Medium 0.72 🔗python
面试题 16.17 Contiguous Sequence LCCI Easy 0.60 🔗python
面试题 02.04 Partition List LCCI Medium 0.66 🔗python
面试题 17.16 The Masseuse LCCI Easy 0.52 🔗python
面试题 17.10 Find Majority Element LCCI Easy 0.57 🔗python
LCP 19 秋叶收藏集 Medium 0.52 🔗python

About

python刷leetcode记录。项目含有详细的代码注释和解题思路,并配有对应的leetcode中英文题目。The project contains detailed code comments and solution ideas(chinese), and has corresponding leetcode question content(Chinese and English).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published