This repository contains structured lessons for mastering Data Structures and Algorithms (DSA) using Golang.
Each category (e.g., Arrays & Hashing, Two Pointers, etc.) contains multiple problems, and each problem has one or more solutions exploring different algorithmic strategies.
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|---|---|---|
| Problem-01: Contains Duplicate | Brute Force | O(nΒ²) | O(1) |
| Sorting | O(n log n) | O( 1 ) | |
| β Hash Set | O(n) | O(n) | |
| β Hash Set Length | O(n) | O(n) | |
| Problem-02: Valid Anagram | Sorting | O(n log n + m log m) | O(n + m) |
| β Hash Map | O(n) | O(k) | |
| β Hash Table (Using Array) | O(n + m) | O(1) | |
| Problem-03: Two Sum | Brute Force | O(nΒ²) | O(1) |
| Sorting + Two Pointers | O(n log n) | O(n) | |
| β Hash Map (Two Pass) | O(n) | O(n) | |
| Hash Map (One Pass) | O(n) | O(n) | |
| Problem-04: Group Anagrams | Sorting | O(n log n + m log m) | O(1) |
| β Hash Table | O(n + m) | O(1) | |
| Problem-05: Top K Frequent Elements | Sorting | O(n log n) | O(n) |
| Min-Heap | O(n log k) | O(n+k) | |
| β Bucket Sort | O(n) | O(n) |
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
| Problem | Solution Approaches | Time Complexity | Space Complexity |
|---|
# Example: run solution-01 of problem-01 in category-01
cd category-01/problem-01/solution-01
go run main.go./dsa.sh category --interactive # To create category
./dsa.sh problem --interactive # To create problem
./dsa.sh solution --interactive # To create solution# Save
nano dsa.sh # paste the script, save
# Make executable
chmod +x dsa.sh
# Create a category
./dsa.sh category --cat 1 --label "Arrays & Hashing"
# Add a problem (auto-picks next problem-XX)
./dsa.sh problem --cat 1 --prob auto --title "Contains Duplicate" --difficulty Easy --tags "Arrays,Hashing"
# Add a second problem later (no need to touch existing files)
./dsa.sh problem --cat 1 --prob auto --title "Valid Anagram" --difficulty Easy --tags "Arrays,Hashing,Strings"
# Add solutions any time (auto-picks next solution-XX)
./dsa.sh solution --cat 1 --prob 1 --sol auto --title "Solution-01: Brute Force" --approach "Brute Force" --tags "Brute Force,Intro"
./dsa.sh solution --cat 1 --prob 1 --sol auto --title "Solution-02: Sorting" --approach "Sorting" --tags "Sorting,Array"
# Fully interactive (asks everything)
./dsa.sh problem --interactive
./dsa.sh solution --interactive