Skip to content

Clearzero22/awesome-algorithms-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 Algorithms for Interviews

A curated collection of algorithm solutions and notes for coding interviews.

✨ Features

  • 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

📚 Topics Covered

  • Arrays & Two Pointers
  • Strings & KMP
  • Linked Lists
  • Binary Search
  • Sliding Window
  • Trees & Graphs
  • Dynamic Programming
  • Design Problems (LRU, Trie, etc.)

🚀 How to Use

  1. Clone this repo
  2. Pick a topic from SOLUTIONS/
  3. Read the code + comments
  4. Try to solve it yourself first!
  5. Add your own version to practice

📁 Project Structure

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)

📌 Recommended Practice Order

Beginner (0-3 months)

  1. Arrays & Two Pointers - Foundation of algorithmic thinking
  2. Strings - Pattern matching and manipulation
  3. Binary Search - Essential search technique

Intermediate (3-6 months)

  1. Linked Lists - Pointer manipulation
  2. Stack & Queue - Data structure fundamentals
  3. Sliding Window - Advanced two-pointer technique

Advanced (6+ months)

  1. Trees & Graphs - Complex data structures
  2. Dynamic Programming - Problem optimization
  3. Design Problems - System design thinking

💡 Tips for Success

  • 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

🔧 Usage Examples

Using Utility Structs

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
}

Running Tests

# 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

📊 Progress Tracking

  • 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)

🤝 Contributing

This is a personal learning repository, but feel to:

  • Fork and adapt for your own use
  • Suggest improvements to organization
  • Report issues with solutions

📞 Support

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."

About

awesome-algorithms-practice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published