TristanWYL / leetcode.py

Leetcode solution in python with clear explanation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leetcode solutions in Python

Features:

✅ Clear explanation
✅ Time complexity and space complexity
✅ Some problems may include more than one solution

Actively being updated. STAY TUNED!

List

# Title Categories Difficulty
1 Two Sum iteration and dict Easy
3 Longest Substring Without Repeating Characters dp Medium
5 Longest Palindromic Substring dp Medium
7 Reverse Integer n/a Medium
9 Palindrome Number n/a Easy
10 Regular Expression Matching dp Hard
12 Integer to Roman n/a Medium
13 Roman to Integer n/a Easy
14 Longest Common Prefix n/a Easy
15 3Sum n/a Medium
16 3Sum Closest n/a Medium
17 Letter Combinations of a Phone Number n/a Medium
18 4Sum n/a Medium
19 Remove Nth Node From End of List linked list Medium
20 Valid Parentheses n/a Easy
22 Generate Parentheses n/a Medium
24 Swap Nodes in Pairs linked list Medium
26 Remove Duplicates from Sorted Array n/a Easy
27 Remove Element n/a Easy
31 Next Permutation n/a Medium
35 Search Insert Position bisection Easy
38 Count and Say n/a Medium
39 Combination Sum backtrack
dp
Medium
43 Multiply Strings n/a Medium
46 Permutations backtrack
DFS
BFS
Medium
47 Permutations II backtrack
DFS
BFS
Medium
77 Combinations backtrack
DFS
BFS
Medium
92 Reverse Linked List II n/a Medium
100 Same Tree binary tree Easy
101 Symmetric Tree binary tree Easy
104 Maximum Depth of Binary Tree binary tree Easy
110 Balanced Binary Tree binary tree Easy
111 Minimum Depth of Binary Tree binary tree Easy
114 Flatten Binary Tree to Linked List binary tree Medium
121 Best Time to Buy and Sell Stock dp Easy
122 Best Time to Buy and Sell Stock II dp Medium
141 Linked List Cycle linked list Easy
142 Linked List Cycle II linked list Medium
206 Reverse Linked List linked list Easy
207 Course Schedule graph Medium
210 Course Schedule II graph Medium
226 Invert Binary Tree binary tree Easy
234 Palindrome Linked List linked list Easy
257 Binary Tree Paths binary tree Easy
295 Find Median from Data Stream heap Hard
300 Longest Increasing Subsequence dp Medium
322 Coin Change dp Medium
354 Russian Doll Envelopes dp Hard
382 Linked List Random Node linked list Medium
430 Flatten a Multilevel Doubly Linked List linked list Medium
475 Heaters bisection Medium
494 Target Sum backtrack
dp
Medium
509 Fibonacci Number n/a Easy
563 Binary Tree Tilt binary tree Easy
654 Maximum Binary Tree binary tree Medium
655 Print Binary Tree binary tree Medium
707 Design Linked List linked list Medium
719 Find K-th Smallest Pair Distance bisection Hard
725 Split Linked List in Parts linked list Medium
752 Open the Lock n/a Medium
797 All Paths From Source to Target graph Medium
817 Linked List Components linked list Medium
857 Minimum Cost to Hire K Workers heap Hard
875 Koko Eating Bananas bisection Medium
931 Minimum Falling Path Sum dp Medium
965 Univalued Binary Tree binary tree Easy
968 Binary Tree Cameras binary tree Hard
1439 Find the Kth Smallest Sum of a Matrix With Sorted Rows heap Hard
1449 Form Largest Integer With Digits That Add up to Target dp Hard
1609 Even Odd Tree binary tree Medium

About

Leetcode solution in python with clear explanation