https://github.com/digitalcrab/leetcode-problems-go
Problems from leetcode with solutions in Go
https://github.com/digitalcrab/leetcode-problems-go
go golang leetcode leetcode-golang leetcode-solutions
Last synced: 4 months ago
JSON representation
Problems from leetcode with solutions in Go
- Host: GitHub
- URL: https://github.com/digitalcrab/leetcode-problems-go
- Owner: digitalcrab
- Created: 2018-10-30T20:04:33.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-05-19T10:45:37.000Z (6 months ago)
- Last Synced: 2025-05-19T11:42:42.724Z (6 months ago)
- Topics: go, golang, leetcode, leetcode-golang, leetcode-solutions
- Language: Go
- Size: 215 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LeetCode solutions in Go
### Data structures implemented in golang
1. Linked Lists (insertion, deletion, search, reverse):
- [x] Singly linked list
- [x] Doubly linked list
2. Stacks (push, pop, peek):
- [x] Using arrays/slices
- [x] Using linked lists
3. Queues:
- [x] Using arrays/slices
- [x] Using linked lists
4. Hash Tables (insert, delete, search)
- [x] Basic implementation
5. Trees (insertion, deletion, traversal: inorder, preorder, postorder):
- [x] Binary tree
- [x] Binary Search Tree (BST)
- [x] AVL tree (self-balancing)
6. Heaps (insert, delete, extract-min/max):
- [x] Min-Heap
- [x] Max-Heap
7. Graphs (add edge, remove edge, search: DFS, BFS):
- [ ] Adjacency matrix
- [ ] Adjacency list
### Algorithms implemented in golang
1. Sorting Algorithms:
- [ ] Bubble sort
- [ ] Selection sort
- [ ] Insertion sort
- [ ] Merge sort
- [ ] Quick sort
- [ ] Heap sort
2. Searching Algorithms:
- [ ] Linear search
- [ ] Binary search
3. Graph Algorithms:
- [ ] Depth-First Search (DFS)
- [ ] Breadth-First Search (BFS)
- [ ] Dijkstra’s algorithm (shortest path)
- [ ] Floyd-Warshall algorithm (all pairs shortest path)
4. Dynamic Programming:
- [ ] Fibonacci sequence
- [ ] Longest Common Subsequence (LCS)
- [ ] Knapsack problem
- [ ] Coin change problem
5. Backtracking:
- [ ] N-Queens problem
- [ ] Sudoku solver
- [ ] Subset sum problem
### LeetCode Problems and solutions
| Number | Title | Difficulty | Solution |
|-------:|:---------------------------------------------------|:----------:|:----------------------------------------------------------------------------------------------------------------------------|
| 1 | Two Sum | Easy | [two-sum](leetcode-solutions/two-sum) |
| 3 | Longest Substring Without Repeating Characters | Medium | [longest-substring-without-repeating-characters](leetcode-solutions/longest-substring-without-repeating-characters) |
| 12 | Integer to Roman | Medium | [integer-to-roman](leetcode-solutions/integer-to-roman) |
| 13 | Roman to Integer | Easy | [roman-to-integer](leetcode-solutions/roman-to-integer) |
| 14 | Longest Common Prefix | Easy | [longest-common-prefix](leetcode-solutions/longest-common-prefix) |
| 19 | Remove Nth Node From End of List | Medium | [remove-nth-node-from-end-of-list](leetcode-solutions/remove-nth-node-from-end-of-list) |
| 20 | Valid Parentheses | Easy | [valid-parentheses](leetcode-solutions/valid-parentheses) |
| 22 | Generate Parentheses | Medium | [generate-parentheses](leetcode-solutions/generate-parentheses) |
| 26 | Remove Duplicates from Sorted Array | Easy | [remove-duplicates-from-sorted-array](leetcode-solutions/remove-duplicates-from-sorted-array) |
| 27 | Remove Element | Easy | [remove-element](leetcode-solutions/remove-element) |
| 28 | Find the Index of the First Occurrence in a String | Easy | [find-the-index-of-the-first-occurrence-in-a-string](leetcode-solutions/find-the-index-of-the-first-occurrence-in-a-string) |
| 36 | Valid Sudoku | Medium | [valid-sudoku](leetcode-solutions/valid-sudoku) |
| 49 | Group Anagrams | Medium | [group-anagrams](leetcode-solutions/group-anagrams) |
| 58 | Length of Last Word | Easy | [length-of-last-word](leetcode-solutions/length-of-last-word) |
| 80 | Remove Duplicates from Sorted Array II | Medium | [remove-duplicates-from-sorted-array-ii](leetcode-solutions/remove-duplicates-from-sorted-array-ii) |
| 88 | Merge Sorted Array | Easy | [merge-sorted-array](leetcode-solutions/merge-sorted-array) |
| 121 | Best Time to Buy and Sell Stock | Easy | [best-time-to-buy-and-sell-stock](leetcode-solutions/best-time-to-buy-and-sell-stock) |
| 122 | Best Time to Buy and Sell Stock II | Medium | [best-time-to-buy-and-sell-stock-ii](leetcode-solutions/best-time-to-buy-and-sell-stock-ii) |
| 125 | Valid Palindrome | Easy | [valid-palindrome](leetcode-solutions/valid-palindrome) |
| 128 | Longest Consecutive Sequence | Medium | [longest-consecutive-sequence](leetcode-solutions/longest-consecutive-sequence) |
| 136 | Single Number | Easy | [single-number](leetcode-solutions/single-number) |
| 141 | Linked List Cycle | Easy | [linked-list-cycle](leetcode-solutions/linked-list-cycle) |
| 142 | Linked List Cycle II | Medium | [linked-list-cycle-ii](leetcode-solutions/linked-list-cycle-ii) |
| 150 | Evaluate Reverse Polish Notation | Medium | [evaluate-reverse-polish-notation](leetcode-solutions/evaluate-reverse-polish-notation) |
| 155 | Min Stack | Medium | [min-stack](leetcode-solutions/min-stack) |
| 160 | Intersection of Two Linked Lists | Easy | [intersection-of-two-linked-lists](leetcode-solutions/intersection-of-two-linked-lists) |
| 169 | Majority Element | Easy | [majority-element](leetcode-solutions/majority-element) |
| 170 | Two Sum III - Data structure design | Easy | [two-sum-iii-data-structure-design](leetcode-solutions/two-sum-iii-data-structure-design) |
| 189 | Rotate Array | Medium | [rotate-array](leetcode-solutions/rotate-array) |
| 202 | Happy Number | Easy | [happy-number](leetcode-solutions/happy-number) |
| 205 | Isomorphic Strings | Easy | [isomorphic-strings](leetcode-solutions/isomorphic-strings) |
| 217 | Contains Duplicate | Easy | [contains-duplicate](leetcode-solutions/contains-duplicate) |
| 219 | Contains Duplicate II | Easy | [contains-duplicate-ii](leetcode-solutions/contains-duplicate-ii) |
| 238 | Product of Array Except Self | Medium | [product-of-array-except-self](leetcode-solutions/product-of-array-except-self) |
| 242 | Valid Anagram | Easy | [valid-anagram](leetcode-solutions/valid-anagram) |
| 249 | Group Shifted Strings | Medium | [group-shifted-strings](leetcode-solutions/group-shifted-strings) |
| 271 | Encode and Decode Strings | Medium | [encode-and-decode-strings](leetcode-solutions/encode-and-decode-strings) |
| 288 | Unique Word Abbreviation | Medium | [unique-word-abbreviation](leetcode-solutions/unique-word-abbreviation) |
| 347 | Top K Frequent Elements | Medium | [top-k-frequent-elements](leetcode-solutions/top-k-frequent-elements) |
| 350 | Intersection of Two Arrays II | Easy | [intersection-of-two-arrays-ii](leetcode-solutions/intersection-of-two-arrays-ii) |
| 359 | Logger Rate Limiter | Easy | [logger-rate-limiter](leetcode-solutions/logger-rate-limiter) |
| 380 | Insert Delete GetRandom O(1) | Medium | [insert-delete-getrandom-o1](leetcode-solutions/insert-delete-getrandom-o1) |
| 383 | Ransom Note | Easy | [ransom-note](leetcode-solutions/ransom-note) |
| 387 | First Unique Character in a String | Easy | [first-unique-character-in-a-string](leetcode-solutions/first-unique-character-in-a-string) |
| 412 | Fizz Buzz | Easy | [fizz-buzz](leetcode-solutions/fizz-buzz) |
| 454 | 4Sum II | Medium | [4sum-ii](leetcode-solutions/4sum-ii) |
| 599 | Minimum Index Sum of Two Lists | Easy | [minimum-index-sum-of-two-lists](leetcode-solutions/minimum-index-sum-of-two-lists) |
| 652 | Find Duplicate Subtrees | Medium | [find-duplicate-subtrees](leetcode-solutions/find-duplicate-subtrees) |
| 707 | Design Linked List | Medium | [design-linked-list](leetcode-solutions/design-linked-list) |
| 739 | Daily Temperatures | Medium | [daily-temperatures](leetcode-solutions/daily-temperatures) |
| 771 | Jewels and Stones | Easy | [jewels-and-stones](leetcode-solutions/jewels-and-stones) |
| 876 | Middle of the Linked List | Easy | [middle-of-the-linked-list](leetcode-solutions/middle-of-the-linked-list) |
| 1342 | Number of Steps to Reduce a Number to Zero | Easy | [richest-customer-wealth](leetcode-solutions/richest-customer-wealth) |
| 1480 | Running Sum of 1d Array | Easy | [running-sum-of-1d-array](leetcode-solutions/running-sum-of-1d-array) |
| 1672 | Richest Customer Wealth | Easy | [richest-customer-wealth](leetcode-solutions/richest-customer-wealth) |