专栏首页Albert陈凯2018-12-15 LintCode LeeCode刷题指南 part1

2018-12-15 LintCode LeeCode刷题指南 part1

Java Algorithm Problems

程序员的一天

从开始这个Github已经有将近两年时间, 很高兴这个repo可以帮到有需要的人. 我一直认为, 知识本身是无价的, 因此每逢闲暇, 我就会来维护这个repo, 给刷题的朋友们一些我的想法和见解. 下面来简单介绍一下这个repo:

README.md: 所有所做过的题目

ReviewPage.md: 所有题目的总结和归纳(不断完善中)

KnowledgeHash2.md: 对所做过的知识点的一些笔记

SystemDesign.md: 对系统设计的一些笔记

Future Milestone: 我准备将一些有意思的题目,做成视频的形式给大家参考

希望大家学习顺利, 对未来充满希望(程序员也是找到好老板的!) 有问题可以给我写邮件(wangdeve@gmail.com), 或者在GitHub上发issue给我.

Squence

Problem

Level

Language

Tags

Video Tutorial

0

Count of Smaller Number before itself.java

Hard

Java

[]

1

Evaluate Division.java

Medium

Java

[BFS, DFS, Graph, Union Find]

2

Fraction to Recurring Decimal.java

Medium

Java

[Hash Table, Math]

3

Gray Code.java

Medium

Java

[Backtracking]

4

Hamming Distance.java

Easy

Java

[]

5

Happy Number.java

Easy

Java

[]

6

HashWithArray.java

Easy

Java

[]

7

Heaters.java

Easy

Java

[]

8

IndexMatch.java

Easy

Java

[]

9

Insert Node in a Binary Search Tree .java

Easy

Java

[BST]

10

Jewels and Stones.java

Easy

Java

[Hash Table]

11

Kth Smallest Sum In Two Sorted Arrays.java

Hard

Java

[]

12

LFU Cache.java

Hard

Java

[Design, Hash Table]

13

Longest Univalue Path.java

Easy

Java

[]

14

Majority Number II.java

Medium

Java

[Enumeration, Greedy]

15

Majority Number III.java

Medium

Java

[Hash Table, Linked List]

16

Matrix Zigzag Traversal.java

Easy

Java

[]

17

Maximum Subarray III.java

Review

Java

[]

18

Minimum Absolute Difference in BST.java

Easy

Java

[BST]

19

Minimum Height Trees.java

Medium

Java

[BFS, Graph]

20

Missing Ranges.java

Medium

Java

[Array]

21

Next Permutation.java

Medium

Java

[Array]

22

O(1) Check Power of 2.java

Easy

Java

[Bit Manipulation]

23

Palindrome Permutation II.java

Medium

Java

[Backtracking, Permutation]

24

Partition Array by Odd and Even.java

Easy

Java

[Array, Two Pointers]

25

Pascal's Triangle II.java

Easy

Java

[]

26

Permutation Index.java

Easy

Java

[]

27

Permutation Sequence.java

Medium

Java

[Backtracking, Math]

28

Prefix and Suffix Search.java

Hard

Java

[Trie]

29

Product of Array Exclude Itself.java

Medium

Java

[Array]

30

Recover Rotated Sorted Array.java

Easy

Java

[Array]

31

Remove Duplicates from Unsorted List.java

Medium

Java

[Linked List]

32

Remove Node in Binary Search Tree.java

Hard

Java

[BST]

33

Reshape the Matrix.java

Easy

Java

[]

34

Reverse String.java

Easy

Java

[]

35

Rotate Image.java

Medium

Java

[Array, Enumeration]

36

Search in Rotated Sorted Array II.java

Medium

Java

[Array, Binary Search]

37

Search Insert Position.java

Easy

Java

[]

38

Shortest Word Distance.java

Easy

Java

[]

39

Single Number II.java

Medium

Java

[Bit Manipulation]

40

Single Number III.java

Medium

Java

[Bit Manipulation]

41

Single Number.java

Easy

Java

[]

42

Space Replacement.java

Medium

Java

[String]

43

Stone Game.java

Medium

Java

[DP]

44

String Permutation.java

Easy

Java

[]

45

Subarray Sum II.java

Hard

Java

[Array, Binary Search, Two Pointers]

46

The Smallest Difference.java

Medium

Java

[Array, Sort, Two Pointers]

47

Total Occurrence of Target.java

Medium

Java

[]

48

Trailing Zeros.java

Easy

Java

[Math]

49

Two Lists Sum.java

Medium

Java

[Linked List]

50

Two Strings Are Anagrams.java

Easy

Java

[]

51

Valid Sudoku.java

Easy

Java

[Enumeration, Hash Table]

52

Word Pattern.java

Easy

Java

[]

53

Zigzag Iterator.java

Medium

Java

[BST]

54

Find Anagram Mappings.java

Easy

Java

[Hash Table]

55

Judge Route Circle.java

Easy

Java

[String]

56

Island Perimeter.java

Easy

Java

[Hash Table]

57

Power of Three.java

Easy

Java

[Math]

58

Plus One.java

Easy

Java

[Array, Math]

59

Power of Two.java

Easy

Java

[Bit Manipulation, Math]

60

Reverse Vowels of a String.java

Easy

Java

[String, Two Pointers]

61

Guess Number Higher or Lower.java

Easy

Java

[Binary Search]

62

Encode and Decode TinyURL.java

Medium

Java

[Hash Table, Math]

63

Wiggle Sort.java

Medium

Java

[Array, Sort]

64

Queue Reconstruction by Height.java

Medium

Java

[Greedy]

65

Two Sum II - Input array is sorted.java

Medium

Java

[Array, Binary Search, Two Pointers]

66

2 Sum II.java

Medium

Java

[Array, Binary Search, Two Pointers]

67

Coin Change.java

Medium

Java

[Backpack DP, DP, Memoization]

68

Maximum Product Subarray.java

Medium

Java

[Array, DP, Subarray]

69

3 Sum Closest.java

Medium

Java

[Array, Two Pointers]

70

Triangle Count.java

Medium

Java

[Array]

71

3Sum.java

Medium

Java

[Array, Two Pointers]

72

k Sum.java

Hard

Java

[DP]

73

Unique Binary Search Tree.java

Medium

Java

[BST, DP, Tree]

74

Trim a Binary Search Tree.java

Easy

Java

[BST, Tree]

75

Unique Paths II.java

Medium

Java

[Array, Coordinate DP, DP]

76

Bomb Enemy.java

Medium

Java

[Coordinate DP, DP]

77

3Sum Smaller.java

Medium

Java

[Array, Two Pointers]

78

Array Partition I.java

Easy

Java

[Array]

79

1-bit and 2-bit Characters.java

Easy

Java

[Array]

80

Non-decreasing Array.java

Easy

Java

[Array]

81

Max Consecutive Ones.java

Easy

Java

[Array]

82

Find All Numbers Disappeared in an Array.java

Easy

Java

[Array]

83

Maximum Average Subarray I.java

Easy

Java

[Array, Subarray]

84

Largest Number At Least Twice of Others.java

Easy

Java

[Array]

85

Toeplitz Matrix.java

Easy

Java

[Array]

86

Sum of Two Integers.java

Easy

Java

[Bit Manipulation]

87

Swap Bits.java

Easy

Java

[Bit Manipulation]

88

Update Bits.java

Medium

Java

[Bit Manipulation]

89

Maximum XOR of Two Numbers in an Array.java

Medium

Java

[Bit Manipulation, Trie]

90

Perfect Squares.java

Medium

Java

[BFS, DP, Math, Partition DP]

91

Backpack VI.java

Medium

Java

[Backpack DP, DP]

92

Copy Books.java

Hard

Java

[Binary Search, DP, Partition DP]

93

Valid Perfect Square.java

Review

Java

[Binary Search, Math]

94

Intersection of Two Arrays II.java

Easy

Java

[Binary Search, Hash Table, Sort, Two Pointers]

95

Scramble String.java

Hard

Java

[DP, Interval DP, String]

96

Binary Search Tree Iterator.java

Medium

Java

[BST, Design, Stack, Tree]

97

Flatten Nested List Iterator.java

Medium

Java

[Design, Stack]

98

Best Time to Buy and Sell Stock with Cooldown.java

Medium

Java

[DP]

99

Find Peak Element.java

Medium

Java

[Array, Binary Search]

100

Longest Common Subsequence.java

Medium

Java

[DP, Double Sequence DP, Sequence DP]

101

Interleaving String.java

Hard

Java

[DP, String]

102

Letter Combinations of a Phone Number.java

Medium

Java

[Backtracking, String]

103

Edit Distance.java

Hard

Java

[DP, Double Sequence DP, Sequence DP, String]

104

Distinct Subsequences.java

Hard

Java

[DP, String]

105

Majority Element.java

Easy

Java

[Array, Bit Manipulation, Divide and Conquer]

106

Ones and Zeroes.java

Hard

Java

[DP]

107

Pow(x, n).java

Medium

Java

[Binary Search, Math]

108

Word Break II.java

Hard

Java

[Backtracking, DFS, DP, Hash Table, Memoization]

109

Nested List Weight Sum.java

Easy

Java

[BFS, DFS]

110

Same Tree.java

Easy

Java

[DFS, Tree]

111

Convert Sorted Array to Binary Search Tree.java

Easy

Java

[DFS, Divide and Conquer, Tree]

112

Construct Binary Tree from Preorder and Inorder Traversal.java

Medium

Java

[Array, DFS, Divide and Conquer, Hash Table, Tree]

113

Add Digits.java

Easy

Java

[Math]

114

Add Two Numbers.java

Medium

Java

[Linked List, Math]

115

Add Two Numbers II.java

Medium

Java

[Linked List]

116

Balanced Binary Tree.java

Medium

Java

[DFS, Tree]

117

Valid Anagram.java

Easy

Java

[Hash Table, Sort]

118

Populating Next Right Pointers in Each Node.java

Medium

Java

[DFS, Divide and Conquer, Tree]

119

Validate Binary Search Tree.java

Medium

Java

[BST, DFS, Divide and Conquer, Tree]

120

Convert Sorted List to Binary Search Tree.java

Medium

Java

[BST, DFS, Divide and Conquer, Linked List]

121

Flatten Binary Tree to Linked List.java

Medium

Java

[Binary Tree, DFS]

122

Binary Tree Paths.java

Easy

Java

[Backtracking, Binary Tree, DFS]

123

Minimum Size Subarray Sum.java

Medium

Java

[Array, Binary Search, Subarray, Two Pointers]

124

Longest Substring Without Repeating Characters.java

Medium

Java

[Hash Table, String, Two Pointers]

125

Minimum Window Substring.java

Hard

Java

[Hash Table, String, Two Pointers]

126

Linked List Cycle.java

Easy

Java

[Linked List, Two Pointers]

127

Remove Nth Node From End of List.java

Medium

Java

[Linked List, Two Pointers]

128

Longest Substring with At Most K Distinct Characters.java

Hard

Java

[Hash Table, Sliding Window, String]

129

Linked List Cycle II.java

Medium

Java

[Linked List, Math, Two Pointers]

130

Kth Smallest Element in a Sorted Matrix.java

Medium

Java

[Binary Search, Heap]

131

Find Minimum in Rotated Sorted Array.java

Medium

Java

[Array, Binary Search]

132

Find Minimum in Rotated Sorted Array II.java

Hard

Java

[Array, Binary Search]

133

Connecting Graph.java

Medium

Java

[Union Find]

134

Connecting Graph II.java

Medium

Java

[Union Find]

135

Connecting Graph III.java

Medium

Java

[Union Find]

136

Number of Islands.java

Medium

Java

[BFS, DFS, Matrix DFS, Union Find]

137

Number of Islands II.java

Hard

Java

[Union Find]

138

Surrounded Regions.java

Medium

Java

[BFS, DFS, Matrix DFS, Union Find]

139

Implement Trie (Prefix Tree).java

Medium

Java

[Design, Trie]

140

Add and Search Word - Data structure design.java

Medium

Java

[Backtracking, Design, Trie]

141

Word Search II.java

Hard

Java

[Backtracking, DFS, Trie]

142

Word Search.java

Medium

Java

[Array, Backtracking, DFS]

143

Word Squares.java

Hard

Java

[Backtracking, Trie]

144

Trapping Rain Water.java

Hard

Java

[Array, Stack, Two Pointers]

145

Min Stack.java

Easy

Java

[Design, Stack]

146

Implement Queue using Stacks.java

Easy

Java

[Design, Stack]

147

Decode String.java

Medium

Java

[DFS, Divide and Conquer, Stack]

148

Largest Rectangle in Histogram.java

Hard

Java

[Array, Monotonous Stack, Stack]

149

Maximum Binary Tree.java

Medium

Java

[Stack, Tree]

150

Reverse Integer.java

Easy

Java

[Math]

151

Swap Nodes in Pairs.java

Medium

Java

[Linked List]

152

Find Peak Element II.java

Hard

Java

[Binary Search, DFS, Divide and Conquer]

153

Sqrt(x).java

Easy

Java

[Binary Search, Math]

154

First Bad Version.java

Easy

Java

[Binary Search]

155

Wood Cut.java

Medium

Java

[Binary Search]

156

Find the Duplicate Number.java

Medium

Java

[Array, Binary Search, Two Pointers]

157

Palindrome Pairs.java

Hard

Java

[Hash Table, String, Trie]

158

Game of Life.java

Medium

Java

[Array]

159

Maximum Average Subarray II.java

Review

Java

[Array, Binary Search, PreSum]

160

Meeting Rooms.java

Easy

Java

[PriorityQueue, Sort, Sweep Line]

161

Number of Airplane in the sky.java

Medium

Java

[Array, Interval, PriorityQueue, Sort, Sweep Line]

162

Meeting Rooms II.java

Medium

Java

[Greedy, Heap, PriorityQueue, Sort, Sweep Line]

163

The Skyline Problem.java

Review

Java

[Binary Indexed Tree, Divide and Conquer, Heap, PriorityQueue, Segment Tree, Sweep Line]

164

Unique Path.java

Medium

Java

[Array, Coordinate DP, DP]

165

Maximal Rectangle.java

Hard

Java

[Array, DP, Hash Table, Stack]

166

Maximal Square.java

Medium

Java

[Coordinate DP, DP]

167

Longest Increasing Path in a Matrix.java

Hard

Java

[Coordinate DP, DFS, DP, Memoization, Topological Sort]

168

Coins in a Line.java

Medium

Java

[DP, Game Theory, Greedy]

169

Coins in a Line II.java

Medium

Java

[Array, DP, Game Theory, Memoization, MiniMax]

170

Binary Tree Inorder Traversal.java

Easy

Java

[Hash Table, Stack, Tree]

171

Binary Tree Postorder Traversal.java

Medium

Java

[Stack, Tree, Two Stacks]

172

Change to Anagram.java

Easy

Java

[String]

173

Classical Binary Search.java

Easy

Java

[Binary Search]

174

Climbing Stairs.java

Easy

Java

[DP, Memoization, Sequence DP]

175

Coins in a Line III.java

Hard

Java

[Array, DP, Game Theory, Interval DP, Memoization]

176

Closest Binary Search Tree Value.java

Easy

Java

[BST, Binary Search, Tree]

177

Compare Version Numbers.java

Medium

Java

[String]

178

Count Complete Tree Nodes.java

Medium

Java

[Binary Search, Tree]

179

Course Schedule.java

Medium

Java

[BFS, Backtracking, DFS, Graph, Topological Sort]

180

Course Schedule II.java

Medium

Java

[BFS, DFS, Graph, Topological Sort]

181

Binary Tree Preorder Traversal.java

Easy

Java

[BFS, DFS, Stack, Tree]

182

Closest Number in Sorted Array.java

Easy

Java

[Binary Search]

183

Complete Binary Tree.java

Easy

Java

[BFS, Tree]

184

Compare Strings.java

Easy

Java

[String]

185

Contains Duplicate.java

Easy

Java

[Array, Hash Table]

186

Contains Duplicate II.java

Easy

Java

[Array, Hash Table]

187

Contains Duplicate III.java

Medium

Java

[BST]

188

Burst Balloons.java

Hard

Java

[DP, Divide and Conquer, Interval DP, Memoization]

189

Nim Game.java

Easy

Java

[Brainteaser, DP, Game Theory]

190

Convert Integer A to Integer B.java

Easy

Java

[Bit Manipulation]

191

Cosine Similarity.java

Easy

Java

[Basic Implementation]

192

Count 1 in Binary.java

Easy

Java

[Bit Manipulation]

193

Count and Say.java

Easy

Java

[Basic Implementation, String]

194

K Edit Distance.java

Hard

Java

[DP, Double Sequence DP, Sequence DP, Trie]

195

Jump Game.java

Medium

Java

[Array, DP, Greedy]

196

Coin Change 2.java

Medium

Java

[Backpack DP, DP]

197

Paint House.java

Easy

Java

[DP, Sequence DP, Status DP]

198

Decode Ways.java

Medium

Java

[DP, Partition DP, String]

199

Longest Continuous Increasing Subsequence.java

Easy

Java

[Array, Coordinate DP, DP]

200

Minimum Path Sum.java

Medium

Java

[Array, Coordinate DP, DP]

201

Counting Bits.java

Medium

Java

[Bit Manipulation, Bitwise DP, DP]

202

Continuous Subarray Sum.java

Medium

Java

[Coordinate DP, DP, Math, Subarray]

203

House Robber.java

Easy

Java

[DP, Sequence DP]

204

House Robber II.java

Medium

Java

[DP, Sequence DP, Status DP]

205

House Robber III.java

Medium

Java

[DFS, DP, Status DP, Tree]

206

Paint House II.java

Hard

Java

[DP, Sequence DP, Status DP]

207

Best Time to Buy and Sell Stock III.java

Hard

Java

[Array, DP, Sequence DP]

208

Best Time to Buy and Sell Stock IV.java

Hard

Java

[DP, Sequence DP]

209

Russian Doll Envelopes.java

Hard

Java

[Binary Search, Coordinate DP, DP]

210

Permutation in String.java

Medium

Java

[Two Pointers]

211

Permutations II.java

Medium

Java

[Backtracking]

212

Shuffle an Array.java

Medium

Java

[Permutation]

213

Find All Anagrams in a String.java

Easy

Java

[Hash Table, Sliding Window]

214

Group Anagrams.java

Medium

Java

[Hash Table, String]

215

Backpack.java

Medium

Java

[Backpack DP, DP]

216

Backpack II.java

Medium

Java

[Backpack DP, DP]

217

Backpack V.java

Medium

Java

[Backpack DP, DP]

218

Count Primes.java

Easy

Java

[Hash Table, Math]

219

Delete Node in a Linked List.java

Easy

Java

[Linked List]

220

Excel Sheet Column Number.java

Easy

Java

[Math]

221

Excel Sheet Column Title.java

Easy

Java

[Math]

222

Flip Game.java

Easy

Java

[String]

223

Expression Tree Build.java

Hard

Java

[Binary Tree, Expression Tree, Minimum Binary Tree, Stack]

224

Expression Evaluation.java

Hard

Java

[Binary Tree, DFS, Expression Tree, Minimum Binary Tree, Stack]

225

Convert Expression to Polish Notation.java

Hard

Java

[Binary Tree, DFS, Expression Tree, Stack]

226

Convert Expression to Reverse Polish Notation.java

Hard

Java

[Binary Tree, DFS, Expression Tree, Stack]

227

Evaluate Reverse Polish Notation.java

Medium

Java

[Stack]

228

Decode Ways II.java

Hard

Java

[DP, Enumeration, Partition DP]

229

Palindrome Partitioning II.java

Hard

Java

[DP, Partition DP]

230

Backpack III.java

Hard

Java

[Backpack DP, DP]

231

First Missing Positive.java

Hard

Java

[Array]

232

Implement strStr().java

Easy

Java

[String, Two Pointers]

233

Insertion Sort List.java

Medium

Java

[Linked List, Sort]

234

Interleaving Positive and Negative Numbers.java

Medium

Java

[Two Pointers]

235

Largest Number.java

Medium

Java

[Sort]

236

Last Position of Target.java

Easy

Java

[Binary Search]

237

Length of Last Word.java

Easy

Java

[String]

238

Longest Common Substring.java

Medium

Java

[DP, Double Sequence DP, Sequence DP, String]

239

Longest Increasing Continuous subsequence.java

Easy

Java

[Array, Coordinate DP, DP]

240

Longest Increasing Continuous subsequence II.java

Medium

Java

[Array, Coordinate DP, DP, Memoization]

241

N-Queens.java

Hard

Java

[Backtracking]

242

N-Queens II.java

Hard

Java

[Backtracking]

243

Maximum Subarray.java

Easy

Java

[Array, DFS, DP, Divide and Conquer, PreSum, Sequence DP, Subarray]

244

Maximum Subarray II.java

Medium

Java

[Array, DP, Greedy, PreSum, Sequence DP, Subarray]

245

Median.java

Easy

Java

[Array, Quick Select, Quick Sort]

246

Middle of Linked List.java

Easy

Java

[Linked List]

247

Singleton.java

Easy

Java

[Design]

248

Remove Linked List Elements.java

Easy

Java

[Linked List]

249

Fibonacci.java

Easy

Java

[DP, Math, Memoization]

250

Palindrome Linked List.java

Easy

Java

[Linked List, Two Pointers]

251

Reverse Linked List.java

Easy

Java

[Linked List]

252

Reverse Linked List II .java

Medium

Java

[Linked List]

253

Intersection of Two Linked Lists.java

Easy

Java

[Linked List]

254

Palindrome Permutation.java

Easy

Java

[Hash Table]

255

Valid Palindrome.java

Easy

Java

[String, Two Pointers]

256

Implement Stack using Queues.java

Easy

Java

[Design, Stack]

257

Implement Stack.java

Easy

Java

[Stack]

258

Invert Binary Tree.java

Easy

Java

[BFS, DFS, Tree]

259

Maximum Depth of Binary Tree.java

Easy

Java

[DFS, Tree]

260

Minimum Depth of Binary Tree.java

Easy

Java

[BFS, DFS, Tree]

261

Symmetric Tree.java

Easy

Java

[BFS, DFS, Tree]

262

Tweaked Identical Binary Tree.java

Easy

Java

[DFS, Tree]

263

Merge Two Binary Trees.java

Easy

Java

[DFS, Tree]

264

Subtree.java

Easy

Java

[DFS, Tree]

265

Lowest Common Ancestor of a Binary Tree.java

Medium

Java

[DFS, Tree]

266

Lowest Common Ancestor II.java

Easy

Java

[Hash Table, Tree]

267

Lowest Common Ancestor of a Binary Search Tree.java

Medium

Java

[BST, DFS, Tree]

268

Hash Function.java

Easy

Java

[Hash Table]

269

Merge Two Sorted Lists.java

Easy

Java

[Linked List]

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 2018-12-15 LintCode LeeCode刷题指南 part2

    |270|Missing Number.java|Easy|Java|[Array, Bit Manipulation, Math]|| |271|LRU C...

    Albert陈凯
  • OkHttp3的基本用法

    这篇文章说下OkHttp的基本用法,是最新的3哦,如果你曾经在网上搜索OkHttp怎么使用发现有些类没有了可能是因为人家说的是2。

    Albert陈凯
  • Mac在Hadoop的yarn上运行mapreduce报错ExitCodeException exitCode=127:

    hadoop 2.7.2 17/04/14 14:07:00 INFO mapreduce.Job: Job job_1492146520853_0005 r...

    Albert陈凯
  • 18个Java小技巧,从运行、控制到框架

    1. JVM相关 JVM作为java运行的基础,很难相信对于JVM一点都不了解的人可以把java语言吃得很透。我在面试有超过3年Java经验的开发者的时候, J...

    BestSDK
  • 知识总结:Java的21个技术点

    关于Java的编程知识,有人会问哪几个是重要的知识点,不知道大家是否知道呢?给大家分享一下! 1、JVM相关(包括了各个版本的特性) 对于刚刚接触Java的人来...

    牛客网
  • Java的21个技术点,你知道吗?

    关于Java的编程知识,有人会问哪几个是重要的知识点,不知道大家是否知道呢?给大家分享一下!

    Java团长
  • Java的21个技术点,你知道吗?

    关于Java的编程知识,有人会问哪几个是重要的知识点,不知道大家是否知道呢?给大家分享一下!

    Java团长
  • Java 8 和 Java 9 中并发工具的改变

    Java 8 和 Java 9中 concurrent 包有了一些改变, 本文对这些改变做了汇总。

    用户1257393
  • Java 8 和 Java 9 中并发工具的改变

    Java 8 和 Java 9中 concurrent 包有了一些改变, 本文对这些改变做了汇总。

    用户1257393
  • J2那几个E和Web基础

    静儿

扫码关注云+社区

领取腾讯云代金券