/LeetCodePractice

LeetCode练习

Primary LanguageJava

LeetCode Practice

我的LeetCode练习

项目结构

.
|--src
   |--main
   |  |--java  //题目答案,包名对应题目编号。50道题分为一个Section
   |--test
      |--java  //单元测试

使用Intellij IDEA时设置src/main/java为源码目录,src/test/java为测试源码目录。

题目列表

# Title Solution Difficulty
1 Two Sum Solution Easy
2 Add Two Numbers Solution Medium
4 Median of Two Sorted Arrays Solution Hard
6 ZigZag Conversion Solution Medium
7 Reverse Integer Solution Easy
9 Palindrome Number Solution Easy
11 Container With Most Water Solution Medium
12 Integer to Roman Solution Medium
13 Roman to Integer Solution Easy
14 Longest Common Prefix Solution Easy
17 Letter Combinations of a Phone Number Solution Medium
19 Remove Nth Node From End of List Solution Medium
20 Valid Parentheses Solution Easy
21 Merge Two Sorted Lists Solution Easy
22 Generate Parentheses Solution Medium
24 Swap Nodes in Pairs Solution Medium
26 Remove Duplicates from Sorted Array Solution Easy
27 Remove Element Solution Easy
35 Search Insert Position Solution Easy
36 Valid Sudoku Solution Medium
39 Combination Sum Solution Medium
40 Combination Sum II Solution Medium
46 Permutations Solution Medium
47 Permutations II Solution Medium
48 Rotate Image Solution Medium
53 Maximum Subarray Solution Easy
54 Spiral Matrix Solution Medium
58 Length of Last Word Solution Easy
59 Spiral Matrix II Solution Medium
62 Unique Paths Solution Medium
63 Unique Paths II Solution Medium
64 Minimum Path Sum Solution Medium
66 Plus One Solution Easy
67 Add Binary Solution Easy
69 Sqrt(x) Solution Easy
70 Climbing Stairs Solution Easy
73 Set Matrix Zeroes Solution Medium
77 Combinations Solution Medium
78 Subsets Solution Medium
83 Remove Duplicates from Sorted List Solution Easy
88 Merge Sorted Array Solution Easy
94 Binary Tree Inorder Traversal Solution Medium
96 Unique Binary Search Trees Solution Medium
100 Same Tree Solution Easy
101 Symmetric Tree Solution Easy
102 Binary Tree Level Order Traversal Solution Medium
103 Binary Tree Zigzag Level Order Traversal Solution Medium
104 Maximum Depth of Binary Tree Solution Easy
105 Construct Binary Tree from Preorder and Inorder Traversal Solution Medium
106 Construct Binary Tree from Inorder and Postorder Traversal Solution Medium
107 Binary Tree Level Order Traversal II Solution Easy
108 Convert Sorted Array to Binary Search Tree Solution Easy
110 Balanced Binary Tree Solution Easy
111 Minimum Depth of Binary Tree Solution Easy
112 Path Sum Solution Easy
113 Path Sum II Solution Medium
114 Flatten Binary Tree to Linked List Solution Medium
118 Pascal's Triangle Solution Easy
119 Pascal's Triangle II Solution Easy
121 Best Time to Buy and Sell Stock Solution Easy
122 Best Time to Buy and Sell Stock II Solution Easy
129 Sum Root to Leaf Numbers Solution Medium
136 Single Number Solution Easy
137 Single Number II Solution Medium
141 Linked List Cycle Solution Easy
144 Binary Tree Preorder Traversal Solution Medium
155 Min Stack Solution Easy
169 Majority Element Solution Easy
172 Factorial Trailing Zeroes Solution Easy
189 Rotate Array Solution Easy
191 Number of 1 Bits Solution Easy
198 House Robber Solution Easy
203 Remove Linked List Elements Solution Easy
205 Isomorphic Strings Solution Easy
206 Reverse Linked List Solution Easy
216 Combination Sum III Solution Medium
217 Contains Duplicate Solution Easy
226 Invert Binary Tree Solution Easy
231 Power of Two Solution Easy
237 Delete Node in a Linked List Solution Easy
258 Add Digits Solution Easy
283 Move Zeroes Solution Easy
292 Nim Game Solution Easy
303 Range Sum Query - Immutable Solution Easy
326 Power of Three Solution Easy
344 Reverse String Solution Easy
347 Top K Frequent Elements Solution Medium
371 Sum of Two Integers Solution Easy
374 Guess Number Higher or Lower Solution Easy
389 Find the Difference Solution Easy
412 Fizz Buzz Solution Easy
429 N-ary Tree Level Order Traversal Solution Medium
448 Find All Numbers Disappeared in an Array Solution Easy
461 Hamming Distance Solution Easy
463 Island Perimeter Solution Easy
509 Fibonacci Number Solution Easy
538 Convert BST to Greater Tree Solution Easy
617 Merge Two Binary Trees Solution Easy
637 Average of Levels in Binary Tree Solution Easy
657 Robot Return to Origin Solution Easy
700 Search in a Binary Search Tree Solution Easy
704 Binary Search Solution Easy
709 To Lower Case Solution Easy
771 Jewels and Stones Solution Easy
783 Minimum Distance Between BST Nodes Solution Easy
867 Transpose Matrix Solution Easy
876 Middle of the Linked List Solution Easy
961 N-Repeated Element in Size 2N Array Solution Easy
965 Univalued Binary Tree Solution Easy
1108 Defanging an IP Address Solution Easy