Skip to content

Genpeng/play-with-leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

我的 LeetCode 刷题之旅

努力奋斗

前言

其实,自己一开始刷题的目的就想跟封面图一样——装个 B,但是刷着刷着确实发现刷题是有乐趣的,而且在未看答案的情况下能成功写出题解,确实会给自己带来一些成就感,因此也就坚持下来了。

为了更加方便地去管理自己刷过的题目,方便自己在下一次重刷的时候能够对上一次的题解进行优化,遂有了这个项目。

01. Array

# Title Difficulty Tags Note C++ Java Python
1 Two Sum Easy array,hash table [1], [2] solution
4 Median of Two Sorted Arrays Hard array,divide and conquer,binary search [1],[2],[3],[4]
11 Container With Most Water Medium array,two pointers [1],[2]
15 3Sum Medium array,hash table,two pointers [1],[2],[3]
16 3Sum Closest Medium array,two pointers [1]
26 Remove Duplicates From Sorted Array Easy array [1]
33 Search in Rotated Sorted Array Medium array,binary search [1]
46 Permutations Medium array,backtracking [1],[2]
47 Permutations II Medium array,backtracking [1]
54 Spiral Matrix Medium array [1],[2]
56 Merge Intevals Medium array [1]
59 Spiral Matrix II Medium array [1]
66 Plus One Easy array [1]
78 Subsets Medium array,backtracking,bit manipulation [1],[2],[3]
88 Merge Sorted Array Easy array,two pointers [1]
89 Gray Code Medium array [1]
90 Subsets II Medium array,backtracking [1]
136 Single Number Easy array,hash table,bit manipulation [1],[2],[3],[4]
153 Find Minimum in Rotated Sorted Array array,binary search [1]
167 Two Sum II - Input Array is Sorted Easy array,binary search,two pointers,hash table [1],[2],[3]
169 Majority Element Easy array,hash table,bit manipulation link [1],[2],[3]
215 Kth Largest Element in an Array Medium array,heap,divide and conquer [1],[2],[3],[4]
217 Contains Duplicate Easy array,hash table [1],[2],[3]
238 Product of Array Except Self Medium array [1],[2]
239 Sliding Window Maximum Hard array,heap,dp [1],[2],[3]
283 Move Zeros Easy array [1],[2],[3]
289 Game of Life Medium array [1],[2]
349 Intersection of Two Arrays Easy array link [1],[2],[3]
350 Intersection of Two Arrays II Easy array,hash table,two pointers link [1],[2]
525 Contiguous Array Medium array,hash table [1],[2]
560 Subarray Sum Equals K Medium array,hash table [1],[2],[3],[4]
695 Max Area of Island Medium array,dfs,bfs [1]
704 Binary Search Easy array,binary search [1]
724 Find Pivot Index Easy array [1]
744 Find Smallest Letter Greater Than Target Easy array,binary search [1],[2]
747 Largest Number at Least Twice of Others Easy array [1]
912 Sort an Array Medium array [1],[2],[3]
945 Minimum Increment to Make Array Uniques Medium array [1],[2],[3]
994 Rotting Oranges Easy array,bfs [1]
1013 Partition Array Into Three Parts With Equal Sum Easy array [1]
1160 Find Words That Can be Formed by Characters Easy array,hash table [1]
1162 As Far From Land as Possible Easy array,bfs,dfs [1]
1426 Counting Elements Easy array,hash table [1],[2]

02. String

# Title Difficulty Tags Note C++ Java Python
3 Longest Substring Without Repeating Characters Medium string,hash table,two pointers [1],[2],[3],[4]
8 String to Integer (atoi) Medium string,math [1],[2]
14 Longest Common Prefix Easy string,two pointers,binary search,divide and conquer [1],[2],[3]
20 Valid Parentheses Easy string,stack link [1]
22 Generate Parentheses Medium string,backtracking,bfs,dfs [1],[2],[3],[4]
43 Multiply Strings Medium string,math [1]
151 Reverse Words in a String Medium string,two pointers [1],[2],[3]
186 Reverse Words in a String II Medium string,two pointers [1]
344 Reverse String Easy string,two pointers [1]
409 Longest Palindrome Easy string,hash table [1]
557 Reverse Words in a String III Easy string [1],[2]
678 Valid Parenthesis String Medium string,dp,greedy [1],[2],[3]
844 Backspace String Compare Medium string,stack,two pointers [1],[2]
890 Find and Replace Pattern Medium string [1],[2],[3]
1111 Maximum Nesting Depth of Two Valid Parentheses Strings Medium string [1]
1427 Perform String Shifts Easy string [1]

03. Linked List

# Title Difficulty Tags Note C++ Java Python
2 Add Two Numbers Medium linked list link [1],[2]
19 Remove Nth Node From End of List Medium linked list [1]
21 Merge Two Sorted Lists Easy linked list link [1],[2]
23 Merge k Sorted Lists Hard linked list [1],[2],[3],[4],[5],[6]
24 Swap Nodes in Pairs Medium linked list [1],[2]
61 Rotate List Medium linked list [1]
141 Linked List Cycle Easy linked list link [1],[2]
142 Linked List Cycle II Medium linked list link [1],[2]
148 Sort List Medium linked list [1],[2]
160 Intersection of Two Linked List Easy linked list link [1],[2]
203 Remove Linked List Elements Easy linked list [1]
206 Reverse Linked List Easy linked list link [1],[2]
237 Delete Node in a Linked List Easy linked list link [1]
876 Middle of the Linked List Easy linked list [1]

04. Tree

# Title Difficulty Tags Note C++ Java Python
94 Binary Tree Inorder Traversal Medium tree,dfs link [1],[2],[3]
98 Validate Binary Search Tree Medium tree,dfs [1],[2],[3]
102 Binary Tree Level Order Traversal Medium tree,bfs,dfs [1],[2]
103 Binary Tree Zigzag Level Order Traversal Medium tree,bfs,dfs [1],[2]
104 Maximum Depth of Binary Tree Easy tree,bfs [1],[2],[3]
111 Minimum Depth of Binary Tree Easy tree,bfs [1],[2]
124 Binary Tree Maximum Path Sum Hard tree [1],[2]
144 Binary Tree Preorder Traversal Medium tree,dfs link [1],[2]
145 Binary Tree Postorder Traversal Hard tree,dfs [1],[2]
226 Invert Binary Tree Easy tree,bfs,dfs [1],[2],[3]
230 Kth Smallest Element in a BST Medium tree,bfs [1],[2]
235 Lowest Common Ancestor of a Binary Search Tree Easy tree [1],[2]
236 Lowest Common Ancestor of a Binary Tree Medium tree,dfs [1],[2],[3]
543 Diameter of Binary Tree Easy tree,dfs [1],[2]
1008 Construct Binary Search Tree From Preorder Traversal Medium tree [1],[2],[3]

05. Stack & Queue

# Title Difficulty Tags Note C++ Java Python
255 Implement Stack using Queues Easy stack,queue,design [1],[2],[3]
232 Implement Queue using Stacks Easy stack,queue,design [1],[2]
496 Next Greater Element I Easy stack,map [1],[2]
682 Baseball Game Easy stack [1]

06. Heap & Priority Queue

# Title Difficulty Tags Note C++ Java Python
347 Top K Frequent Elements Medium heap,hash table [1]
692 Top K Frequent Words Medium heap,hash table,trie [1],[2],[3],[4]
703 Kth Largest Element in a Stream Easy heap [1]
1046 Last Stone Weight Easy heap [1]

07. Math & Digit

# Title Difficulty Tags Note C++ Java Python
7 Reverse Integer Easy math link [1]
9 Palindrome Number Easy math link [1]
136 Single Number Easy math,bit manipulation link [1],[2],[3]
169 Majority Element Easy math,array link [1],[2],[3]
231 Power of Two Easy math,bit manipulation link [1],[2],[3]
365 Water And Jug Problem Medium math,bfs,dfs [1],[2],[3]
836 Rectangle Overlap Easy math [1],[2]
892 Surface Area of 3D Shapes Easy math [1]
1103 Distribute Candies to People Easy math [1],[2]

08. DP

# Title Difficulty Tags Note C++ Java Python
5 Longest Palindromic Substring Medium dp,string [1],[2],[3],[4],[5],[6]
53 Maximum Subarray Easy dp,array,divide and conquer [1],[2],[3],[4]
55 Jump Game Medium dp,array,greedy [1],[2],[3],[4]
70 Climbing Stairs Easy dp [1],[2],[3],[4],[5],[6]
72 Edit Distance Hard dp [1],[2]
120 Triangle Medium dp,array [1]
121 Best Time to Buy and Sell Stock Easy dp [1],[2]
122 Best Time to Buy and Sell Stock II Easy dp [1]
132 Palindrome Partitioning II Hard dp,string [1],[2],[3],[4]
300 (Length of) Longest Increaing Subsequence Medium dp,array,bianry search [1],[2],[3],[4],[5]
322 Coin Change Medium dp [1],[2],[3]
343 Integer Break Medium dp,math [1]
516 (Length) of Longest Palindromic Subsequence Medium dp,string [1],[2],[3],[4],[5]
887 Super Egg Drop Hard dp,math,binary search [1]
1143 Longest Common Subsequence Medium dp,string [1],[2],[3],[4]
1312 Minimum Insertion Steps to Make a String Palindromic Hard dp,string [1]

09. Design

# Title Difficulty Tags Note C++ Java Python
146 LRU Cache Medium design [1],[2]
155 Min Stack Easy design,stack [1],[2]
460 LFU Cache Hard design [1]
1429 First Unique Number Medium design [1]

10. Others

# Title Difficulty Tags Note C++ Java Python
412 Fizz Buzz Easy [1],[2],[3]

About

My Java and Python solutions for LeetCode problems. ( ^ _ ^ ) V

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published