Awesome Open Source
Awesome Open Source

go-leetcode

Golang solution for leetcode. For each problem, there is a simple *_test.go to test the solution, and you can run go test under corresponding folder.

1. two sum

2. add two numbers

3. longest substring without repeating characters

4. median of two sorted arrays

5. longest palindromic substring

6. zigzag conversion

7. reverse integer

8. string to integer

9. palindrome number

10. Regular Expression Matching

11. container with most water

12. integer to roman

13. roman to integer

14. longest common prefix

15. 3sum

16. 3sum closest

17. letter combinations of a phone number

18. 4sum

19. remove nth node from end of list

20. valid parentheses

21. merge two sorted lists

22. generate parentheses

23. merge k sorted lists

24. swap nodes in pairs

25. reverse nodes in k group

26. Remove Duplicates from Sorted Array

27. Remove Element

31. Next Permutation

32. longest valid parentheses

33. search in rotated sorted array

34. search for a range

35. search insert position

36. valid sudoku

38. count and say

39. combination sum

40. combination sum ii

41. first missing positive

42. trapping rain water

43. multiply strings

46. permutations

47. permutations II

48. rotate image

49. group anagrams

50. pow(x,n)

51. n queens

52. n queens II

53. maximum subarray

54. spiral matrix

55. jump game

58. length of last word

59. spiral matrix II

60. permutation sequence

61. rotate list

62. unique paths

63. unique paths II

64. minimum path sum

65. valid number

66. plus one

67. add binary

70. climbing stairs

72. edit distance

73. set matrix zeroes

74. search a 2D matrix

75. sort colors

76. minimum window substring

77. combinations

78. subsets

79. word search(not solved)

80. Remove Duplicates from Sorted Array II

81. Search in Rotated Sorted Array II

82. remove duplicates from sorted list II

83. remove duplicates from sorted list

84. largest rectangle in histogram

85. maximal rectangle

86. partition list

88. merge sorted array

89. gray code

90. subsets II

91. decode ways

92. reverse linked list II

93. Restore IP Addresses

94. Binary Tree Inorder Traversal

95. Unique Binary Search Trees II

96. Unique Binary Search Trees

98. validate binary search tree

100. same tree

101. symmetric tree

102. Binary Tree Level Order Traversal

103. Binary Tree Zigzag Level Order Traversal

104. maximum depth of binary tree

105. construct binary tree from preorder and inorder traversal

106. construct binary tree from inorder and postorder traversal

107. Binary Tree Level Order Traversal II

108. Convert Sorted Array to Binary Search Tree

109. Convert Sorted List to Binary Search Tree

110. Balanced Binary Tree

111. minimum depth of binary tree

112. path sum

113. path sum II

114. Flatten Binary Tree to Linked List

115. distinct subsequences

116. Populating Next Right Pointers in Each Node

117. Populating Next Right Pointers in Each Node II

118. pascal's triangle

119. pascal's triangle II

120. triangle

121. Best Time to Buy and Sell Stock

122. Best Time to Buy and Sell Stock II

123. Best Time to Buy and Sell Stock III

124. binary tree maximum path sum

125. valid palindrome

126. word ladder II

127. word ladder

128. longest consecutive sequence

129. sum root to leaf numbers

130. surrounded regions

131. palindrome partitioning

132. palindrome partitioning II

133. Clone Graph

134. gas station

135. candy

136. single number

137. single number II

138. copy_list_with_random_pointer

139. word break

140. word break II

141. Linked List Cycle

142. Linked List Cycle II

143. reorder list

144. binary tree preorder traversal

145. binary tree postorder traversal

146. LRU Cache

147. insertion sort list

148. sort list

149. Max Points on a Line

150. evaluate reverse polish notation

151. reverse words in a string

152. maximum product subarray

153. find minimum in rotated sorted array

154. find minimum in rotated sorted array II

155. Min Stack

160. Intersection of Two Linked Lists

162. Find Peak Element

164. Maximum Gap

165. compare version numbers

166. Fraction to Recurring Decimal

167. Two Sum II

168. Excel Sheet Column Title

169. Majority Element

171. Excel Sheet Column Number

172. Factorial Trailing Zeroes

173. Binary Search Tree Iterator

174. Dungeon Game

179. Largest Number

187. Repeated DNA Sequences

188. Best Time to Buy and Sell Stock IV

189. Rotate Array

190. Reverse Bits

191. Number of 1 Bits

198. House Robber

199. Binary Tree Right Side View

200. Number of Islands

201. Bitwise AND of Numbers Range

202. Happy Number

203. Remove Linked List Elements

204. Count Primes

205. Isomorphic Strings

206. Reverse Linked List

207. Course Schedule

208. Implement Trie (Prefix Tree)

209. Minimum Size Subarray Sum

210. Course Schedule II

211. Add and Search Word - Data structure design

213. House Robber II

214. Shortest Palindrome (unsolved)

215. Kth Largest Element in an Array

216. Combination Sum III

217. Contains Duplicate

219. Contains Duplicate II

220. Contains Duplicate III (unsolved)

221. Maximal Square

222. Count Complete Tree Nodes

223. Rectangle Area

224. Basic Calculator

225. Implement Stack using Queues

226. Invert Binary Tree

227. Basic Calculator II

228. Summary Ranges

229. Majority Element II

230. Kth Smallest Element in a BST

231. Power of Two

232. Implement Queue using Stacks

234. Palindrome Linked List

235. Lowest Common Ancestor of a Binary Search Tree

236. Lowest Common Ancestor of a Binary Tree

237. Delete Node in a Linked List

238. product of array except self

239. Sliding Window Maximum

240. Search a 2D Matrix II

241. Different Ways to Add Parentheses

242. Valid Anagram

257. Binary Tree Paths

258. Add Digits

260. Single Number III

263. Ugly Number

264. Ugly Number II

268. Missing Number

278. First Bad Version

279. Perfect Squares

282. Expression Add Operators

283. Move Zeroes

284. Peeking Iterator

287. Find the Duplicate Number

290. Word Pattern

292. Nim Game

295. Find Median from Data Stream

297. Serialize and Deserialize Binary Tree

299. Bulls and Cows

300. Longest Increasing Subsequence

301. Remove Invalid Parentheses

303. Range Sum Query - Immutable

304. Range Sum Query 2D - Immutable

306. Additive Number

307. Range Sum Query - Mutable

309. Best Time to Buy and Sell Stock with Cooldown

312. Burst Balloons

313. Super Ugly Number

315. Count of Smaller Numbers After Self

316. Remove Duplicate Letters

318. Maximum Product of Word Lengths

319. Bulb Switcher

322. Coin Change

326. Power of Three

327. Count of Range Sum

329. Longest Increasing Path in a Matrix

331. Verify Preorder Serialization of a Binary Tree

332. Reconstruct Itinerary

334. Increasing Triplet Subsequence

335. Self Crossing

336. Palindrome Pairs

337. House Robber III

338. Counting Bits

341. Flatten Nested List Iterator

342. Power of Four

343. Integer Break

344. Reverse String

345. Reverse Vowels of a String

347. Top K Frequent Elements

349. Intersection of Two Arrays

350. Intersection of Two Arrays II

354. Russian Doll Envelopes

367. Valid Perfect Square

368. Largest Divisible Subset

371. Sum of Two Integers

373. Find K Pairs with Smallest Sums

374. Guess Number Higher or Lower

375. Guess Number Higher or Lower II

376. Wiggle Subsequence

377. Combination Sum IV

378. Kth Smallest Element in a Sorted Matrix

383. Ransom Note

384. Shuffle an Array

386. Lexicographical Numbers

387. First Unique Character in a String

388. Longest Absolute File Path

389. Find the Difference

390. Elimination Game

391. Is Subsequence

394. Decode String

395. Longest Substring with At Least K Repeating Characters

396. Rotate Function

400. Nth Digit

Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Golang (160,486
Tree (20,424
Interview (5,120
Leetcode (3,869
Traversal (1,592
Leetcode Golang (41