Skip to content

gzhh/leetcode-by-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leetcode solutions with golang

Data Structure

Algorithm

Array

# Title Solution Difficulty Importantly
27 Remove Element Golang Easy 🌟
977 Squares of a Sorted Array Golang Easy 🌟
54 Spiral Matrix Golang Medium 🌟
59 Spiral Matrix II Golang Medium 🌟

Linked List

# Title Solution Difficulty Importantly
203 Remove Linked List Elements Golang Easy 🌟🌟
237 Delete Node in a Linked List Golang Easy 🌟🌟
83 Remove Duplicates from Sorted List Golang Easy 🌟🌟
82 Remove Duplicates from Sorted List II Golang Medium 🌟🌟
19 Remove Nth Node From End of List Golang Medium 🔥
206 Reverse Linked List Golang Easy 🔥
92 Reverse Linked List II Golang Medium 🌟🌟
25 Reverse Nodes in k-Group Golang Hard 🔥
24 Swap Nodes in Pairs Golang Medium 🌟
707 Design Linked List Golang Medium 🌟🌟🌟
21 Merge Two Sorted Lists Golang Easy 🔥
23 Merge K Sorted Lists Golang Hard 🔥
141 Linked List Cycle Golang Easy 🔥
142 Linked List Cycle II Golang Medium 🔥
160 Intersection of Two Linked Lists Golang Easy 🔥
876 Middle of the Linked List Golang Easy 🌟🌟🌟
234 Palindrome Linked List Golang Easy 🔥
146 LRU Cache Golang Medium 🔥
147 Insertion Sort List Golang Medium 🔥
148 Sort List Golang Medium 🔥
剑指Offer 18 删除链表的节点 Golang Easy 🌟🌟
剑指Offer 22 链表中倒数第k个节点 Golang Easy 🌟🌟
143 Reorder List Golang Medium 🔥
61 Rotate List Golang Medium 🌟🌟
86 Partition List Golang Medium 🌟🌟
328 Odd Even Linked List Golang Medium 🔥
725 Split Linked List in Parts Golang Medium 🔥

String

# Title Solution Difficulty Importantly
344 Reverse String Golang Easy 🌟
392 Is Subsequence Golang Easy 🌟

Container

# Title Solution Difficulty Importantly
150 Evaluate Reverse Polish Notation Golang Medium 🔥
239 Sliding Window Maximum Golang Hard 🔥
347 Top K Frequent Elements Golang Medium 🔥
32 Longest Valid Parentheses Golang Hard 🔥
155 Min Stack Golang Easy 🔥
394 Decode String Golang Medium 🔥
946 Validate Stack Sequences Golang Medium 🔥
剑指Offer 09 用两个栈实现队列 Golang Easy 🌟
剑指Offer 50 第一个只出现一次的字符 Golang Easy 🌟

Tree

# Title Solution Difficulty Importantly
144 Binary Tree Preorder Traversal Golang Easy 🌟🌟
145 Binary Tree Postorder Traversal Golang Easy 🌟🌟
94 Binary Tree Inorder Traversal Golang Easy 🌟🌟
102 Binary Tree Level Order Traversal Golang Medium 🌟🌟
103 Binary Tree Zigzag Level Order Traversal Golang Medium 🌟🌟
199 Binary Tree Right Side View Golang Medium 🌟🌟
104 Maximum Depth of Binary Tree Golang Easy 🌟🌟
111 Minimum Depth of Binary Tree Golang Easy 🌟🌟
543 Diameter of Binary Tree Golang Easy 🔥
226 Invert Binary Tree Golang Easy 🌟🌟
100 Same Tree Golang Easy 🌟🌟
101 Symmetric Tree Golang Easy 🌟🌟
572 Subtree of Another Tree Golang Easy 🌟🌟
110 Balanced Binary Tree Golang Easy 🌟🌟
257 Binary Tree Paths Golang Easy 🌟🌟
112 Path Sum Golang Easy 🔥
113 Path Sum II Golang Medium 🔥
437 Path Sum III Golang Medium 🔥
124 Binary Tree Maximum Path Sum Golang Hard 🔥
105 Construct Binary Tree from Preorder and Inorder Traversal Golang Medium 🔥
106 Construct Binary Tree from Inorder and Postorder Traversal Golang Medium 🔥
114 Flatten Bianry Tree to Linked List Golang Medium 🔥
617 Merge Two Binary Trees Golang Easy 🔥
700 Search in a Binary Search Tree Golang Easy 🔥
230 Kth Smallest Element in a BST Golang Medium 🔥
95 Unique Binary Search Trees II Golang Medium 🌟🌟
98 Validate Binary Search Tree Golang Medium 🔥
530 Minimum Absolute Difference in BST Golang Medium 🌟
501 Find Mode in Binary Search Tree Golang Easy 🌟
236 Lowest Common Ancestor of a Binary Tree Golang Medium 🔥
235 Lowest Common Ancestor of a Binary Search Tree Golang Easy 🔥
538 Convert BST to Greater Tree Golang Hard 🔥
108 Convert Sorted Array to Binary Search Tree Golang Easy 🌟🌟
109 Convert Sorted List to Binary Search Tree Golang Medium 🌟🌟
701 Inesrt Into a Binary Search Tree Golang Medium 🔥
450 Delete Node in a BST Golang Medium 🔥
669 Trim a Binary Search Tree Golang Medium 🔥
99 Recover Binary Search Tree Golang Medium 🔥
208 Implement Trie Prefix Tree Golang Medium 🔥
297 Serialize and Deserialize Binary Tree Golang Hard 🔥
剑指Offer 54 二叉搜索树的第k大节点 Golang Easy 🔥
剑指Offer 33 二叉搜索树的后序遍历序列 Golang Medium 🌟🌟
剑指Offer 36 二叉搜索树与双向链表 Golang Medium 🔥
129 Sum Root to Leaf Numbers Golang Medium 🌟
404 Sum Of Left Leaves Golang Easy 🌟
513 Find Bottom Left Tree Value Golang Medium 🌟
654 Maximum Binary Tree Golang Medium 🌟
116 Populating Next Right Pointers in Each Node Golang Medium 🌟

Hash Table

# Title Solution Difficulty Importantly
1 Two Sum Golang Easy 🌟
454 4 Sum II Golang Medium 🌟
242 Valid Anagram Golang Easy 🌟
49 Group Anagrams Golang Medium 🔥
438 Find All Anagrams In a String Golang Medium 🔥
128 Longest Consecutive Sequence Golang Medium 🔥
448 Find All Numbers Disappeared in an Array Golang Easy 🔥

Binary Search & Divide and Conquer

# Title Solution Difficulty Importantly
4 Median of Two Sorted Arrays Golang Hard 🔥
33 Search in Rotated Sorted Array Golang Medium 🔥
153 Find Minimum in Rotated Sorted Array Golang Medium 🔥
154 Find Minimum in Rotated Sorted Array II Golang Hard 🌟🌟🌟
34 Find First and Last Position of Element in Sorted Array Golang Medium 🔥
74 Search a 2d-Matrix Golang Medium 🔥
240 Search a 2d-Matrix II Golang Medium 🔥
剑指Offer 53 I 在排序数组中查找数字 I Golang Easy 🔥
剑指Offer 53 II 0~n-1中缺失的数字 Golang Easy 🔥
50 Pow(x, n) Golang Medium 🌟🌟
69 Sqrtx Golang Easy 🔥
367 Valid Perfect Square Golang Easy 🔥

Double Pointer

# Title Solution Difficulty Importantly
15 3Sum Golang Medium 🔥
18 4Sum Golang Medium 🌟🌟
27 Remove Element Golang Easy 🌟
11 Container with Most Water Golang Medium 🔥
75 Sort Colors Golang Medium 🔥
977 Squares of a Sorted Array Golang Easy 🌟
剑指Offer 21 调整数组顺序使奇数位于偶数前面 Golang Easy 🌟🌟
剑指Offer 57 和为s的两个数字 Golang Easy 🌟🌟
剑指Offer 57 II 和为s的连续正数序列 Golang Easy 🔥

Sliding Window

# Title Solution Difficulty Importantly
209 Minimum Size Subarray Sum Golang Medium 🌟
3 Longest Substring Without Repeating Characters Golang Medium 🔥
76 Minimum Window Substring Golang Hard 🔥
239 Sliding Window Maximum Golang Hard 🔥
438 Find All Anagrams In a String Golang Medium 🔥

Depth-first Search

# Title Solution Difficulty Importantly
200 Number of Islands Golang Medium 🔥
695 Max Area of Island Golang Medium 🌟🌟

Back Tracking

# Title Solution Difficulty Importantly
22 Generate Parentheses Golang Medium 🔥
--- --- --- --- ---
77 Combinations Golang Medium 🌟🌟
216 Combination-sum-iii Golang Medium 🌟🌟
17 Letter Combinations of a Phone Number Golang Medium 🔥
39 Combination-sum Golang Medium 🔥
40 Combination-sum-ii Golang Medium 🌟🌟
--- --- --- --- ---
131 Palindrome Partitioning Golang Medium 🔥
93 Restore Ip Addresses Golang Medium 🔥
--- --- --- --- ---
78 Subsets Golang Medium 🔥
90 Subsets II Golang Medium 🔥
491 Increasing Subsequences Golang Medium 🌟🌟🌟
--- --- --- --- ---
46 Permutations Golang Medium 🔥
47 Permutations II Golang Medium 🔥
剑指Offer 38 字符串的排列 Golang Medium 🔥
--- --- --- --- ---
51 N Queens Golang Hard 🔥
79 Word Search Golang Medium 🔥

Greedy

# Title Solution Difficulty Importantly
455 Assign Cookies Golang Easy
376 Wiggle Subsequence Golang Medium 🌟🌟
122 Best Time to Buy and Sell Stock II Golang Easy 🔥
55 Jump Game Golang Easy 🔥
45 Jump Game II Golang Medium 🔥
134 Gas Station Golang Medium 🔥
56 Merge Intervals Golang Medium 🔥
406 Queue Reconstruction by Height Golang Medium 🔥
738 Monotone Increasing Digits Golang Medium 🔥

Dynamic Programing

Fibnacci Number

# Title Solution Difficulty Importantly
509 Fibonacci Number Golang Easy 🌟

Climbing Stairs

# Title Solution Difficulty Importantly
70 Climbing Stairs Golang Easy 🌟🌟
746 Min Cost Climbing Stairs Golang Easy 🌟🌟

Unique Paths & Path Sum

# Title Solution Difficulty Importantly
62 Unique Paths Golang Medium 🔥
63 Unique Paths II Golang Medium 🌟🌟
64 Minimum Path Sum Golang Medium 🔥
剑指Offer 47 礼物的最大价值 Golang Medium 🔥

Integer Break

# Title Solution Difficulty Importantly
343 Integer Break Golang Medium 🌟🌟

Unique Binary Search Trees

# Title Solution Difficulty Importantly
96 Unique Binary Search Trees Golang Medium 🔥
# Title Solution Difficulty Importantly
416 Partition Equal Subset Sum Golang Medium 🔥
1049 Last Stone Weight II Golang Medium 🌟🌟
494 Target Sum Golang Medium 🔥
474 Ones and Zeroes Golang Medium 🔥
# Title Solution Difficulty Importantly
518 Coin Change 2 Golang Medium 🔥
377 Combination Sum IV Golang Medium 🔥
322 Coin Change Golang Medium 🔥
279 Perfect Squares Golang Medium 🔥
139 Word Break Golang Medium 🔥
70 Climbing Stairs Golang Easy 🌟🌟

House Robber

# Title Solution Difficulty Importantly
198 House Robber Golang Medium 🔥
213 House Robber II Golang Medium 🔥
337 House Robber III Golang Medium 🔥

Best Time to Buy and Sell Stock

# Title Solution Difficulty Importantly
121 Best Time to Buy and Sell Stock Golang Easy 🔥
122 Best Time to Buy and Sell Stock II Golang Easy 🔥
123 Best Time to Buy and Sell Stock III Golang Hard 🔥
188 Best Time to Buy and Sell Stock IV Golang Hard 🔥
309 Best Time to Buy and Sell Stock with Cooldown Golang Medium 🔥
714 Best Time to Buy and Sell Stock with Transaction Fee Golang Medium 🔥

Subsequence Problem

# Title Solution Difficulty Importantly
300 Longest Increasing Subsequence Golang Medium 🔥
674 Longest Continuous Increasing Subsequence Golang Easy 🔥
718 Maximum Length of Repeated Subarray Golang Medium 🔥
1143 Longest Common Subsequence Golang Medium 🔥
1035 Uncrossed Line Golang Medium 🔥
53 Maximum Subarray Golang Easy 🌟🌟
# Title Solution Difficulty Importantly
392 Is Subsequence Golang Easy 🌟🌟
115 Distinct Subsequences Golang Hard 🔥
583 Delete Operation for Two Strings Golang Hard 🔥
72 Edit Distance Golang Hard 🔥

Palindromic Substrings & Palindromic Subsequence

# Title Solution Difficulty Importantly
647 Palindromic Substrings Golang Medium 🔥
516 Longest Palindromic Subsequence Golang Medium 🔥
5 Longest Palindromic Substring Golang Medium 🔥

Extra dp problem

# Title Solution Difficulty Importantly
91 Decode Ways Golang Medium 🌟🌟
120 Triangle Golang Medium 🔥
152 Maximum Product Subarray Golang Medium 🔥
221 Maximal Square Golang Medium 🔥
338 Counting Bits Golang Medium 🔥

Monotonic Stack

# Title Solution Difficulty Importantly
739 Daily Temperatures Golang Medium 🔥
496 Next Greater Element I Golang Easy 🔥
503 Next Greater Element II Golang Medium 🌟🌟
42 Trapping Rain Water Golang Hard 🔥
84 Largest Rectangle in Histogram Golang Hard 🔥
85 Maximal Rectangle Golang Hard 🔥

Classical Problems

# Title Solution Difficulty Importantly
215 Kth Largest Element in an Array Golang Medium 🔥
263 Ugly Number Golang Easy 🌟🌟
264 Ugly Number II Golang Medium 🌟
169 Majority Element Golang Easy 🔥

About

Leetcode problem solutions with golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages