Skip to content

aarambh-darshan/rust-100-solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦€ 100 Rust Problems - Solutions

Rust License: MIT Problems PRs Welcome

My personal solutions for the 100 Rust Interview Problems

Complete solutions with explanations, test cases, and complexity analysis

πŸ“š Problems β€’ πŸš€ Quick Start β€’ οΏ½ Progress β€’ 🀝 Contributing


🎯 Challenge Yourself!

🚨 IMPORTANT: This repository is for practicing and learning Rust!

  1. Fork this repository to your own GitHub account
  2. Solve each problem BY YOURSELF β€” No AI assistance!
  3. Track your progress in PROGRESS.md
  4. Learn from your mistakes and improve your skills

🧠 The real learning happens when YOU solve the problems! Using AI defeats the purpose of practice.


✨ Features

  • 🎯 100 Curated Problems β€” From basic syntax to advanced algorithms
  • πŸ“ Clean & Idiomatic Rust β€” Following best practices and conventions
  • πŸ§ͺ Full Test Coverage β€” Every solution includes test cases
  • πŸ“ˆ Complexity Analysis β€” Time & space complexity for each solution
  • πŸ”— Problem Links β€” Direct links to problem descriptions
  • πŸ“ Organized Structure β€” Easy navigation by difficulty and category

πŸ“ Project Structure

rust-100-problems/
β”œβ”€β”€ πŸ“„ Cargo.toml
β”œβ”€β”€ πŸ“– README.md
└── πŸ“‚ src/
    β”œβ”€β”€ main.rs
    └── solutions/
        β”œβ”€β”€ mod.rs                    # Module declarations
        β”‚
        β”œβ”€β”€ 🟒 Beginner (001-035)
        β”‚   β”œβ”€β”€ p001_two_sum.rs
        β”‚   β”œβ”€β”€ p002_reverse_string.rs
        β”‚   └── ...
        β”‚
        β”œβ”€β”€ 🟑 Intermediate (036-070)
        β”‚   β”œβ”€β”€ p036_implement_stack.rs
        β”‚   β”œβ”€β”€ p047_two_sum_hashmap.rs
        β”‚   └── ...
        β”‚
        └── πŸ”΄ Advanced (071-100)
            β”œβ”€β”€ p071_house_robber.rs
            β”œβ”€β”€ p092_lru_cache.rs
            └── ...

πŸš€ Quick Start

Prerequisites

  • Rust 1.75 or later

Installation

# Clone the repository
git clone https://github.com/aarambh-darshan/rust-100-solutions.git
cd rust-100-solutions

# Build the project
cargo build

Running Solutions

# Run all tests
cargo test

# Run tests for a specific problem
cargo test p001                    # Two Sum
cargo test p042                    # Linked List Cycle
cargo test p092                    # LRU Cache

# Run with output
cargo test p001 -- --nocapture

οΏ½ Problem Categories

🟒 Beginner (1-35)

Basic Syntax & Math (1-15)
# Problem Difficulty Topics
001 Two Sum 🟒 Arrays, Hash Map
002 Reverse String 🟒 Strings, Two Pointers
003 Palindrome Number 🟒 Math
004 FizzBuzz 🟒 Loops, Conditionals
005 Fibonacci Number 🟒 Recursion, DP
006 Factorial 🟒 Recursion
007 Count Digits 🟒 Math
008 Sum of Array 🟒 Arrays
009 Find Maximum 🟒 Arrays
010 Find Minimum 🟒 Arrays
011 Even or Odd 🟒 Math
012 Prime Number Check 🟒 Math
013 Leap Year 🟒 Math
014 Celsius to Fahrenheit 🟒 Math
015 Swap Two Numbers 🟒 Variables
Arrays & Strings (16-35)
# Problem Difficulty Topics
016 Reverse Integer 🟒 Math
017 Count Vowels 🟒 Strings
018 Remove Duplicates 🟒 Two Pointers
019 Merge Sorted Arrays 🟒 Arrays
020 Valid Parentheses 🟒 Stack
021 Plus One 🟒 Arrays
022 Sqrt(x) 🟒 Binary Search
023 Climbing Stairs 🟒 DP
024 Remove Element 🟒 Two Pointers
025 Search Insert Position 🟒 Binary Search
026 Length of Last Word 🟒 Strings
027 Add Binary 🟒 Strings, Math
028 Single Number 🟒 Bit Manipulation
029 Best Time to Buy Stock 🟒 Arrays, DP
030 Pascal's Triangle 🟒 Arrays
031 Valid Anagram 🟒 Hash Map
032 First Unique Character 🟒 Hash Map
033 Intersection of Arrays 🟒 Hash Set
034 Move Zeroes 🟒 Two Pointers
035 Power of Two 🟒 Bit Manipulation

🟑 Intermediate (36-70)

Data Structures (36-45)
# Problem Difficulty Topics
036 Implement Stack 🟑 Stack
037 Implement Queue 🟑 Queue
038 Evaluate RPN 🟑 Stack
039 Min Stack 🟑 Stack, Design
040 Reverse Linked List 🟑 Linked List
041 Merge Sorted Lists 🟑 Linked List
042 Linked List Cycle 🟑 Linked List, Floyd's
043 Middle of Linked List 🟑 Linked List
044 Remove Nth From End 🟑 Linked List
045 Palindrome Linked List 🟑 Linked List
HashMaps & HashSets (46-50)
# Problem Difficulty Topics
046 Contains Duplicate 🟑 Hash Set
047 Two Sum HashMap 🟑 Hash Map
048 Group Anagrams 🟑 Hash Map, Strings
049 Top K Frequent 🟑 Hash Map, Heap
050 Longest Consecutive 🟑 Hash Set
Binary Search & Sorting (51-56)
# Problem Difficulty Topics
051 Binary Search 🟑 Binary Search
052 Search Rotated Array 🟑 Binary Search
053 Find Peak Element 🟑 Binary Search
054 First Bad Version 🟑 Binary Search
055 Search 2D Matrix 🟑 Binary Search
056 Sort Colors 🟑 Dutch Flag
Arrays & Intervals (57-67)
# Problem Difficulty Topics
057 Merge Intervals 🟑 Intervals, Sorting
058 Insert Interval 🟑 Intervals
059 Meeting Rooms 🟑 Intervals
060 3Sum 🟑 Two Pointers
061 Container With Water 🟑 Two Pointers
062 Product Except Self 🟑 Arrays
063 Maximum Subarray 🟑 Kadane's Algorithm
064 Spiral Matrix 🟑 Matrix
065 Rotate Image 🟑 Matrix
066 Set Matrix Zeroes 🟑 Matrix
067 Valid Sudoku 🟑 Hash Set, Matrix
Backtracking (68-70)
# Problem Difficulty Topics
068 Subsets 🟑 Backtracking
069 Permutations 🟑 Backtracking
070 Combination Sum 🟑 Backtracking

πŸ”΄ Advanced (71-100)

Dynamic Programming (71-80)
# Problem Difficulty Topics
071 House Robber πŸ”΄ DP
072 Coin Change πŸ”΄ DP
073 Longest Increasing Subsequence πŸ”΄ DP, Binary Search
074 Unique Paths πŸ”΄ DP
075 Jump Game πŸ”΄ Greedy, DP
076 Word Break πŸ”΄ DP, Trie
077 Decode Ways πŸ”΄ DP
078 Longest Common Subsequence πŸ”΄ DP
079 Edit Distance πŸ”΄ DP
080 Maximal Square πŸ”΄ DP, Matrix
Graph Algorithms (81-90)
# Problem Difficulty Topics
081 Number of Islands πŸ”΄ DFS, BFS
082 Clone Graph πŸ”΄ DFS, Hash Map
083 Course Schedule πŸ”΄ Topological Sort
084 Pacific Atlantic πŸ”΄ DFS, BFS
085 Word Ladder πŸ”΄ BFS
086 Alien Dictionary πŸ”΄ Topological Sort
087 Graph Valid Tree πŸ”΄ Union Find
088 Shortest Path Binary Matrix πŸ”΄ BFS
089 Network Delay Time πŸ”΄ Dijkstra's
090 Minimum Spanning Tree πŸ”΄ Kruskal's/Prim's
System Design & Advanced (91-100)
# Problem Difficulty Topics
091 Implement Trie πŸ”΄ Trie
092 LRU Cache πŸ”΄ Hash Map, Linked List
093 Serialize/Deserialize Tree πŸ”΄ Trees, DFS
094 Design Twitter πŸ”΄ OOP, Heap
095 Find Median Stream πŸ”΄ Heap
096 Sliding Window Maximum πŸ”΄ Deque
097 Trapping Rain Water πŸ”΄ Two Pointers, Stack
098 Merge K Sorted Lists πŸ”΄ Heap, Linked List
099 Regular Expression πŸ”΄ DP, Recursion
100 N-Queens πŸ”΄ Backtracking

πŸ“Š Progress Tracker

πŸ“‹ Track your progress: PROGRESS.md

Difficulty Total Completed Progress
🟒 Beginner 35 0
🟑 Intermediate 35 0
πŸ”΄ Advanced 30 0
Total 100 0

🧠 Topics Covered

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        DSA Topics                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Arrays          β”‚ Strings         β”‚ Linked Lists                β”‚
β”‚ Stacks          β”‚ Queues          β”‚ Hash Maps / Sets            β”‚
β”‚ Binary Search   β”‚ Sorting         β”‚ Two Pointers                β”‚
β”‚ Sliding Window  β”‚ Recursion       β”‚ Dynamic Programming         β”‚
β”‚ Backtracking    β”‚ Graphs (DFS/BFS)β”‚ Trees & Tries               β”‚
β”‚ Heaps           β”‚ Greedy          β”‚ Bit Manipulation            β”‚
β”‚ Union Find      β”‚ Topological Sortβ”‚ System Design               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/better-solution)
  3. Commit your changes (git commit -m 'Add optimized solution for problem X')
  4. Push to the branch (git push origin feature/better-solution)
  5. Open a Pull Request

Contribution Guidelines

  • Follow Rust naming conventions and idioms
  • Include test cases for your solutions
  • Add complexity analysis in comments
  • Keep code clean and well-documented

πŸ“š Resources

Resource Description
100 Rust Problems Original problem repository
Rust Book Official Rust documentation
Rust by Example Learn Rust with examples
Rust Playground Online Rust compiler

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


⭐ Star this repo if you find it helpful!

Buy Me A Coffee

Created by Darshan Vichhi πŸ¦€β€οΈ

Fork it. Solve it. Master it. No AI allowed!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages