Skip to content

Latest commit

 

History

History
85 lines (79 loc) · 7.44 KB

README.md

File metadata and controls

85 lines (79 loc) · 7.44 KB

LeetCode solutions in Go

Data structures implemented in golang

  1. Linked Lists (insertion, deletion, search, reverse):
    • Singly linked list
    • Doubly linked list
  2. Stacks (push, pop, peek):
    • Using arrays/slices
    • Using linked lists
  3. Queues:
    • Using arrays/slices
    • Using linked lists
  4. Hash Tables (insert, delete, search)
    • Basic implementation
  5. Trees (insertion, deletion, traversal: inorder, preorder, postorder):
    • Binary tree
    • Binary Search Tree (BST)
    • AVL tree (self-balancing)
  6. Heaps (insert, delete, extract-min/max):
    • Min-Heap
    • 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
12 Integer to Roman Medium integer-to-roman
13 Roman to Integer Easy roman-to-integer
14 Longest Common Prefix Easy longest-common-prefix
20 Valid Parentheses Easy valid-parentheses
22 Generate Parentheses Medium generate-parentheses
26 Remove Duplicates from Sorted Array Easy remove-duplicates-from-sorted-array
27 Remove Element Easy remove-element
28 Find the Index of the First Occurrence in a String Easy find-the-index-of-the-first-occurrence-in-a-string
36 Valid Sudoku Medium valid-sudoku
49 Group Anagrams Medium group-anagrams
58 Length of Last Word Easy length-of-last-word
80 Remove Duplicates from Sorted Array II Medium remove-duplicates-from-sorted-array-ii
88 Merge Sorted Array Easy merge-sorted-array
121 Best Time to Buy and Sell Stock Easy 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
125 Valid Palindrome Easy valid-palindrome
128 Longest Consecutive Sequence Medium longest-consecutive-sequence
150 Evaluate Reverse Polish Notation Medium evaluate-reverse-polish-notation
155 Min Stack Medium min-stack
169 Majority Element Easy majority-element
189 Rotate Array Medium rotate-array
217 Contains Duplicate Easy contains-duplicate
238 Product of Array Except Self Medium product-of-array-except-self
242 Valid Anagram Easy valid-anagram
271 Encode and Decode Strings Medium encode-and-decode-strings
347 Top K Frequent Elements Medium top-k-frequent-elements
739 Daily Temperatures Medium daily-temperatures