Skip to content

Leetcode question cpp solution, 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. Python3 version: https://github.com/JinLexuan/Leetcode-in-python

Notifications You must be signed in to change notification settings

jjjllxx/Leetcode-in-cpp

Repository files navigation

Leetcode-in-cpp

力扣cpp解法,按照算法类型分类,持续更新中。
Leetcode question cpp solution, 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.
Python3 version: Leetcode-in-python

array

15. 3Sum
18. 4Sum
54. Spiral Matrix
74. Search a 2D Matrix
334. Increasing Triplet Subsequence

backtrack

17. Letter Combinations of a Phone Number
22. Generate Parentheses
39. Combination Sum
40. Combination Sum II
46. Permutations
47. Permutations II
51. N-Queens
52. N-Queens II
78. Subsets
90. Subsets II
254. Factor Combinations
1219. Path with Maximum Gold

binary search

33. Search in Rotated Sorted Array
34. Find First and Last Position of Element in Sorted Array
35. Search Insert Position
153. Find Minimum in Rotated Sorted Array 162. Find Peak Element

bit manipulation

89. Gray Code
191. Number of 1 Bits
201. Bitwise AND of Numbers Range

dynamic programming

10. Regular Expression Matching
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
256. Paint House
264. Ugly Number II
265. Paint House II
309. Best Time to Buy and Sell Stock with Cooldown
322. Coin Change
343. Integer Break
368. Largest Divisible Subset
377. Combination Sum IV

graph

130. Surrounded Regions
200. Number of Islands
547. Number of Provinces
329. Longest Increasing Path in a Matrix
733. Flood Fill
997. Find the Town Judge

greedy algorithm

376. Wiggle Subsequence
409. Longest Palindrome

hashtable

1.Two Sum
49. Group Anagrams
187. Repeated DNA Sequences
217. Contains Duplicate
219. Contains Duplicate II
299. Bulls and Cows
389. Find the Difference

heap

347. Top K Frequent Elements
373. Find K Pairs with Smallest Sums

linked list

2.Add Two Numbers
19. Remove Nth Node From End of List
24. Swap Nodes in Pairs
82. Remove Duplicates from Sorted List II
142. Linked List Cycle II
143. Reorder List
160. Intersection of Two Linked Lists
382. Linked List Random Node
445. Add Two Numbers II

math

50. Pow(x, n)
119. Pascal's Triangle II
202. Happy Number
258. Add Digits
279. Perfect Squares
319. Bulb Switcher
326. Power of Three

queue & stack

20. Valid Parentheses
32. Longest Valid Parentheses
150. Evaluate Reverse Polish Notation
155. Min Stack
239. Sliding Window Maximum

sort

56. Merge Intervals

string

3. Longest Substring Without Repeating Characters
5. Longest Palindromic Substring
14. Longest Common Prefix
58. Length of Last Word
151. Reverse Words in a String
242. Valid Anagram
392. Is Subsequence

tree

96. Unique Binary Search Trees
103. Binary Tree Zigzag Level Order Traversal
104. Maximum Depth of Binary Tree
105. Construct Binary Tree from Preorder and Inorder Traversal
108. Convert Sorted Array to Binary Search Tree
110. Balanced Binary Tree
112. Path Sum
113. Path Sum II
117. Populating Next Right Pointers in Each Node II
173. Binary Search Tree Iterator
199. Binary Tree Right Side View
230. Kth Smallest Element in a BST
236. Lowest Common Ancestor of a Binary Tree
404. Sum of Left Leaves

two pointer

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

About

Leetcode question cpp solution, 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. Python3 version: https://github.com/JinLexuan/Leetcode-in-python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages