Skip to content

Leetcode question solution in python, updating.Including array, backtrack, binary search, bit manipulation, dynamic programming, graph, greedy algorithm, hashtable, heap, linked list, math, queue & stack, string, tree and two pointer. Named with question number and question name. Cpp version: https://github.com/JinLexuan/Leetcode-in-cpp

Notifications You must be signed in to change notification settings

jjjllxx/Leetcode-in-python

Repository files navigation

Leetcode-in-python

力扣python解法,按照算法类型分类,持续更新中。
Leetcode question solution in python, updating
Including array, backtrack, binary search, bit manipulation, dynamic programming, graph, greedy algorithm, hashtable, heap, linked list, math, prefix sum, queue & stack, sort, string, tree and two pointer.
Named with question number and question name.
Cpp version: Leetcode-in-cpp

array

15. 3Sum
26. Remove Duplicates from Sorted Array
27. Remove Element
36. Valid Sudoku
48. Rotate Image
59. Spiral Matrix II
73. Set Matrix Zeroes
75. Sort Colors
169. Majority Element
189. Rotate Array
240. Search a 2D Matrix II

backtrack

17. Letter Combinations of a Phone Number
22. Generate Parentheses
37. Sudoku Solver
46. Permutations
52. N-Queens II
78. Subsets

binary search

35. Search Insert Position
153. Find Minimum in Rotated Sorted Array
278. First Bad Version

bit manipulation

7. Reverse Integer 136. Single Number
190. Reverse Bits
191. Number of 1 Bits
231. Power of Two

dynamic programming

45. Jump Game II
62. Unique Paths
63. Unique Paths II
64. Minimum Path Sum
70. Climbing Stairs
72. Edit Distance
91. Decode Ways
120. Triangle
121. Best Time to Buy and Sell Stock
122. Best Time to Buy and Sell Stock II
139. Word Break
152. Maximum Product Subarray
198. House Robber
209. Minimum Size Subarray Sum
213. House Robber II
221. Maximal Square
264. Ugly Number II
309. Best Time to Buy and Sell Stock with Cooldown
322. Coin Change
377. Combination Sum IV

graph

547. Number of Provinces
733. Flood Fill
997. Find the Town Judge

greedy algorithm

300. Longest Increasing Subsequence
376. Wiggle Subsequence
397. Integer Replacement
409. Longest Palindrome

hashtable

1.Two Sum
49. Group Anagrams
217. Contains Duplicate
219. Contains Duplicate II
290. Word Pattern
349. Intersection of Two Arrays
350. Intersection of Two Arrays II
383. Ransom Note
387. First Unique Character in a String

heap

347. Top K Frequent Elements

linked list

2.Add Two Numbers
19. Remove Nth Node From End of List
21. Merge Two Sorted Lists
83. Remove Duplicates from Sorted List
141. Linked List Cycle
203. Remove Linked List Elements
206. Reverse Linked List
237. Delete Node in a Linked List

math

29. Divide Two Integers
118. Pascal's Triangle
119. Pascal's Triangle II
202. Happy Number
263. Ugly Number
279. Perfect Squares
292. Nim Game
319. Bulb Switcher
367. Valid Perfect Square
372. Super Pow
400. Nth Digit

prefix sum

238. Product of Array Except Self
304. Range Sum Query 2D - Immutable

queue & stack

20. Valid Parentheses

sort

56. Merge Intervals

string

3. Longest Substring Without Repeating Characters
5. Longest Palindromic Substring
8. String to Integer (atoi)
9. Palindrome Number
14. Longest Common Prefix
38. Count and Say
151. Reverse Words in a String
205. Isomorphic Strings
242. Valid Anagram

tree

94. Binary Tree Inorder Traversal
96. Unique Binary Search Trees
98. Validate Binary Search Tree
101. Symmetric Tree
102. Binary Tree Level Order Traversal
104. Maximum Depth of Binary Tree
112. Path Sum
116. Populating Next Right Pointers in Each Node
144. Binary Tree Preorder Traversal
145. Binary Tree Postorder Traversal
173. Binary Search Tree Iterator
226. Invert Binary Tree
235. Lowest Common Ancestor of a Binary Search Tree

two pointer

11. Container With Most Water
42. Trapping Rain Water
88. Merge Sorted Array
167. Two Sum II - Input Array Is Sorted
283. Move Zeroes
344. Reverse String

About

Leetcode question solution in python, updating.Including array, backtrack, binary search, bit manipulation, dynamic programming, graph, greedy algorithm, hashtable, heap, linked list, math, queue & stack, string, tree and two pointer. Named with question number and question name. Cpp version: https://github.com/JinLexuan/Leetcode-in-cpp

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages