A curated collection of algorithm solutions and notes for coding interviews.
- Clean, well-commented code in Rust 🦀
- Memory-safe and performant implementations
- Organized by topic (array, string, DP, etc.)
- Includes time/space complexity analysis
- Personal notes on key insights and pitfalls
- Arrays & Two Pointers
- Strings & KMP
- Linked Lists
- Binary Search
- Sliding Window
- Trees & Graphs
- Dynamic Programming
- Design Problems (LRU, Trie, etc.)
- Clone this repo
- Pick a topic from
SOLUTIONS/ - Read the code + comments
- Try to solve it yourself first!
- Add your own version to practice
awesome-algorithms-practice/
├── Cargo.toml # Rust project configuration
├── src/ # Rust source code
│ ├── lib.rs # Library root with module declarations
│ ├── main.rs # Main entry point (optional)
│ └── solutions/ # Algorithm implementations
│ ├── mod.rs # Solution module declarations
│ ├── array/ # Array algorithms
│ ├── string/ # String algorithms
│ ├── linked_list/ # Linked list algorithms
│ └── ... # Other algorithm categories
├── src/utils/ # Utility modules
│ ├── mod.rs # Utility module declarations
│ ├── list_node.rs # ListNode implementation
│ └── tree_node.rs # TreeNode implementation
├── NOTES/ # Algorithm notes and theory
│ ├── array.md
│ ├── string.md
│ ├── linked_list.md
│ └── dp.md
└── SOLUTIONS/ # Directory structure for reference (Python template)
- Arrays & Two Pointers - Foundation of algorithmic thinking
- Strings - Pattern matching and manipulation
- Binary Search - Essential search technique
- Linked Lists - Pointer manipulation
- Stack & Queue - Data structure fundamentals
- Sliding Window - Advanced two-pointer technique
- Trees & Graphs - Complex data structures
- Dynamic Programming - Problem optimization
- Design Problems - System design thinking
- Daily Practice: Even one problem builds momentum
- Quality over Quantity: Understand each solution deeply
- Write Tests: Ensure your solutions work correctly
- Review Notes: Revisit theory regularly
- Mock Interviews: Practice explaining your solutions
use crate::utils::list_node::{ListNode, create_linked_list};
// Create a linked list from values
let values = vec![1, 2, 3, 4, 5];
let head = create_linked_list(values);
// Use in your solution
pub fn reverse_list(mut head: Option<Box<ListNode>>) -> Option<Box<ListNode>> {
let mut prev = None;
while let Some(mut node) = head {
node.next = prev.take();
prev = Some(node);
head = prev.as_mut().unwrap().next.take();
}
prev
}# Build and run all tests
cargo test
# Run specific module tests
cargo test array
# Run with output
cargo test -- --nocapture
# Build only (no tests)
cargo build
# Run with optimizations
cargo test --release- Arrays & Two Pointers (8 problems)
- Strings (6 problems)
- Linked Lists (5 problems)
- Binary Search (4 problems)
- Sliding Window (3 problems)
- Trees & Graphs (8 problems)
- Dynamic Programming (6 problems)
- Design Problems (5 problems)
This is a personal learning repository, but feel to:
- Fork and adapt for your own use
- Suggest improvements to organization
- Report issues with solutions
For questions or collaboration:
- Create an issue in this repository
- Reach out via LinkedIn/GitHub
Happy Coding! 💻🚀
"The best way to learn algorithms is to solve problems consistently and understand the underlying patterns."