leetcode-go
leetcode-go copied to clipboard
✏️ Golang solution for leetcode algorithm problems 📚(continually updating 💪 😃).
Solutions for LeetCode algorithm problems, continually updating.
| ID | Title && solution | Coefficient of difficulty | remarks |
|---|---|---|---|
| 0001 | Two Sum | Easy | array; lookup table |
| 0002 | Add Two Numbers | Medium | linked list |
| 0003 | Longest Substring Without Repeating Characters | Medium | sliding window |
| 0004 | 4. Median of Two Sorted Arrays | Hard | binary search |
| 0007 | 7. Reverse Integer | Easy | math |
| 0009 | 9. Palindrome Number | Easy | math |
| 0011 | 11. Container With Most Water | Medium | array; double index |
| 0013 | 13. Roman to Integer | Easy | math |
| 0014 | 14. Longest Common Prefix | Easy | |
| 0015 | 15. 3Sum | Medium | |
| 0017 | Letter Combinations of a Phone Number | Medium | tree |
| 0019 | 19. Remove Nth Node From End of List | Medium | linked list |
| 0020 | Valid Parentheses | Easy | string; stack |
| 0021 | Merge Two Sorted Lists | Easy | linked list |
| 0023 | 23. Merge k Sorted Lists | Hard | linked list; heap |
| 0024 | 24. Swap Nodes in Pairs | Medium | linked list |
| 0025 | Reverse Nodes in k-Group | Hard | linked list |
| 0026 | Remove Duplicates from Sorted Array | Easy | array; double index |
| 0027 | Remove Element | Easy | array |
| 0028 | 28. Implement strStr() | Easy | double index |
| 0033 | Search in Rotated Sorted Array | Medium | binary search |
| 0034 | Find First and Last Position of Element in Sorted Array | Medium | binary search |
| 0035 | 35. Search Insert Position | Easy | binary search |
| 0048 | 48. Rotate Image | Medium | array |
| 0053 | 53. Maximum Subarray | Easy | dynamic programming |
| 0058 | 58. Length of Last Word | Easy | |
| 0061 | Rotate List | Medium | linked list |
| 0062 | Unique Paths | Medium | recursion; memory search; dynamic programming |
| 0063 | Unique Paths 2 | Medium | recursion; memory search; dynamic programming |
| 0064 | Minimum Path Sum | Medium | dynamic programming; dfs |
| 0066 | 66. Plus One | Easy | math |
| 0067 | add Binary | Easy | |
| 0069 | Sqrt(x) | Easy | binary search |
| 0070 | Climbing Stairs | Easy | dynamic programming |
| 0075 | 75. Sort Colors | Medium | sort |
| 0076 | Minimum Window Substring | Hard | sliding window |
| 0077 | 77. Combinations | Medium | backtracking; combine |
| 0079 | 79. Word Search | Medium | backtracking; array |
| 0080 | 80. Remove Duplicates from Sorted Array II | Medium | double index |
| 0082 | 82. Remove Duplicates from Sorted List II | Medium | linked list |
| 0083 | 83. Remove Duplicates from Sorted List | Easy | linked list |
| 0086 | 86. Partition List | Medium | linked list |
| 0088 | 88. Merge Sorted Array | Easy | sort |
| 0092 | 92. Reverse Linked List II | Medium | linked list |
| 0094 | Binary Tree Inorder Traversal | Medium | binary tree |
| 0100 | Same Tree | Easy | binary tree |
| 0101 | Symmetric Tree | Easy | stack; recursion; iterative |
| 0102 | 102. Binary Tree Level Order Traversal | Medium | binary tree; bfs |
| 0104 | 104. Maximum Depth of Binary Tree | Easy | binary tree |
| 0107 | Binary Tree Level Order Traversal II | Easy | binary tree |
| 0111 | Minimum Depth of Binary Tree | Easy | binary tree |
| 0112 | Path Sum | Easy | binary tree |
| 0120 | Triangle | Medium | dynamic programming; dfs |
| 0121 | 121. Best Time to Buy and Sell Stock | Easy | |
| 0122 | 122. Best Time to Buy and Sell Stock II | Easy | greedy |
| 0125 | Valid Palindrome | Easy | |
| 0136 | 136. Single Number | Easy | hash table; bit manipulation |
| 0144 | 144. Binary Tree Preorder Traversal | Medium | binary tree |
| 0148 | 148. Sort List | Medium | sort; linked list |
| 0150 | 150. Evaluate Reverse Polish Notation | Medium | stack |
| 0153 | 153. Find Minimum in Rotated Sorted Array | Medium | binary search |
| 0155 | 155. Min Stack | Easy | stack |
| 0165 | 165. Compare Version Numbers | Medium | string |
| 0167 | Two Sum II - Input array is sorted | Easy | 对撞指针(双索引) |
| 0179 | 179. Largest Number | Medium | sort |
| 0198 | House Robber | Easy | memory search; dynamic programming |
| 0200 | 200. Number of Islands | Medium | dfs; bfs |
| 0203 | 203. Remove Linked List Elements | Easy | linked list |
| 0206 | 206. Reverse Linked List | Easy | linked list |
| 0208 | 208. Implement Trie (Prefix Tree) | Medium | trie |
| 0209 | Minimum Size Subarray Sum | Medium | sliding window |
| 0211 | 211. Add and Search Word - Data structure design | Medium | trie |
| 0215 | 215. Kth Largest Element in an Array | Medium | sort |
| 0217 | 217. Contains Duplicate | Easy | map |
| 0219 | 219. Contains Duplicate II | Easy | map |
| 0226 | Invert Binary Tree | Easy | recursion; binary tree |
| 0235 | 235. Lowest Common Ancestor of a Binary Search Tree | Easy | recursion; binary tree |
| 0236 | 236. Lowest Common Ancestor of a Binary Tree | Medium | recursion; binary tree |
| 0237 | 237. Delete Node in a Linked List | Easy | linked list |
| 0257 | 257. Binary Tree Paths | Easy | binary tree |
| 0258 | 258. Add Digits | Easy | math |
| 0283 | Move Zeroes(solution1) Move Zeroes(solution2) |
Easy | array |
| 0300 | Longest Increasing Subsequence | Medium | dp |
| 0303 | 303. Range Sum Query - Immutable | Easy | |
| 0304 | 304. Range Sum Query 2D - Immutable | Medium | dp |
| 0307 | 307. Range Sum Query - Mutable | Medium | segment tree |
| 0328 | 328. Odd Even Linked List | Medium | singly linked list |
| 0343 | Integer Break | Medium | recursion; memory search; dynamic programming |
| 0344 | 344. Reverse String | Easy | double index |
| 0345 | 345. Reverse Vowels of a String | Easy | double index |
| 0347 | 347. Top K Frequent Elements | Medium | map; heap; array |
| 0349 | Intersection of Two Arrays | Easy | set |
| 0350 | Intersection of Two Arrays II | Easy | map |
| 0376 | Wiggle Subsequence | Medium | dp |
| 0392 | Is Subsequence | Medium | greedy algorithm |
| 0404 | 404. Sum of Left Leaves | Easy | binary tree |
| 0416 | Partition Equal Subset Sum | Medium | dp; 0-1 knapsack problem |
| 0435 | Non-overlapping Intervals(dp solution) Non-overlapping Intervals(greedy solution) |
Medium | dp; 0-1 knapsack problem |
| 0437 | 437. Path Sum III | Easy | binary tree |
| 0438 | Find All Anagrams in a String | Easy | sliding window |
| 0447 | Number of Boomerangs | Easy | |
| 0454 | 4Sum II | Medium | |
| 0455 | Assign Cookies | Easy | greedy algorithm |
| 0557 | 557. Reverse Words in a String III | Easy | string |
| 0674 | 674. Longest Continuous Increasing Subsequence | Easy | |
| 0677 | 677. Map Sum Pairs | Medium | trie |
| 0704 | Binary Search | Easy | binary search |
| 0713 | 713. Subarray Product Less Than K | Medium | sliding window |
| 0717 | 717. 1-bit and 2-bit Characters | Easy | |
| 0728 | Self Dividing Numbers | Easy | |
| 0735 | 735. Asteroid Collision | Medium | stack |
| 0747 | Largest Number At Least Twice of Others | Easy | |
| 0872 | 872. Leaf-Similar Trees | Easy | binary tree |
| 1021 | 1021. Remove Outermost Parentheses | Easy | stack |