|
2 | 2 |
|
3 | 3 | A comprehensive collection of LeetCode solutions in Rust, featuring multiple algorithmic approaches, extensive testing, and performance benchmarking. |
4 | 4 |
|
5 | | -## Features |
6 | | - |
7 | | -- **13 Problems Solved** across Easy, Medium, and Hard difficulties |
8 | | -- **Multiple Approaches** per problem with complexity analysis |
9 | | -- **280+ Unit Tests** ensuring correctness |
10 | | -- **Property-Based Testing** with proptest |
11 | | -- **Performance Benchmarking** with Criterion |
12 | | -- **Educational Focus** - detailed explanations of why certain approaches work |
13 | | - |
14 | | -## Quick Start |
15 | | - |
16 | | -```bash |
17 | | -# Clone the repository |
18 | | -git clone https://github.com/yourusername/rust-leetcode.git |
19 | | -cd rust-leetcode |
20 | | - |
21 | | -# Run all tests |
22 | | -cargo test |
23 | | - |
24 | | -# Run benchmarks |
25 | | -cargo bench |
26 | | - |
27 | | -# Run specific problem tests |
28 | | -cargo test two_sum |
29 | | -``` |
30 | | - |
31 | | -## Problems Implemented |
32 | | - |
33 | | -### Easy (9) |
34 | | -- Two Sum (#1) |
35 | | -- Reverse Integer (#7) |
36 | | -- Palindrome Number (#9) |
37 | | -- Roman to Integer (#13) |
38 | | -- Longest Common Prefix (#14) |
39 | | -- Valid Parentheses (#20) |
40 | | -- Merge Two Sorted Lists (#21) |
41 | | -- Remove Duplicates from Sorted Array (#26) |
42 | | -- Best Time to Buy and Sell Stock (#121) |
43 | | - |
44 | | -### Medium (6) |
45 | | -- Longest Substring Without Repeating Characters (#3) |
46 | | -- Longest Palindromic Substring (#5) |
47 | | -- Container With Most Water (#11) |
48 | | -- 3Sum (#15) |
49 | | -- LRU Cache (#146) |
50 | | - |
51 | | -### Hard (3) |
52 | | -- Median of Two Sorted Arrays (#4) |
53 | | -- Merge k Sorted Lists (#23) |
54 | | -- Trapping Rain Water (#42) |
55 | | - |
56 | | -## Project Structure |
57 | | - |
58 | | -``` |
59 | | -src/ |
60 | | -├── easy/ # Easy difficulty problems |
61 | | -├── medium/ # Medium difficulty problems |
62 | | -├── hard/ # Hard difficulty problems |
63 | | -├── utils/ # Shared data structures (ListNode, TreeNode) |
64 | | -└── lib.rs # Library root |
65 | | -
|
66 | | -tests/ |
67 | | -├── integration_tests.rs # Integration tests |
68 | | -└── property_tests.rs # Property-based tests |
69 | | -
|
70 | | -benches/ |
71 | | -└── solutions.rs # Performance benchmarks |
72 | | -``` |
73 | | - |
74 | | -## Example Usage |
75 | | - |
76 | | -```rust |
77 | | -use rust_leetcode::easy::two_sum::Solution; |
78 | | - |
79 | | -let solution = Solution::new(); |
80 | | -let result = solution.two_sum(vec![2, 7, 11, 15], 9); |
81 | | -assert_eq!(result, vec![0, 1]); |
82 | | -``` |
83 | | - |
84 | | -## Approach Philosophy |
85 | | - |
86 | | -Each problem includes multiple solutions: |
87 | | -- **Optimal** - The best time/space complexity solution |
88 | | -- **Alternative** - Different approaches with trade-offs |
89 | | -- **Educational** - Suboptimal but instructive implementations |
90 | | - |
91 | | -## Testing |
92 | | - |
93 | | -```bash |
94 | | -# Run all tests with output |
95 | | -cargo test -- --nocapture |
96 | | - |
97 | | -# Run property-based tests |
98 | | -cargo test --test property_tests |
99 | | - |
100 | | -# Run with specific test filter |
101 | | -cargo test container_with_most_water |
102 | | -``` |
103 | | - |
104 | | -## Benchmarking |
105 | | - |
106 | | -See [README_BENCHMARKS.md](README_BENCHMARKS.md) for detailed benchmarking guide. |
107 | | - |
108 | | -```bash |
109 | | -# Run all benchmarks |
110 | | -cargo bench |
111 | | - |
112 | | -# Run specific benchmark |
113 | | -cargo bench two_sum |
114 | | -``` |
115 | | - |
116 | | -## Contributing |
117 | | - |
118 | | -Contributions are welcome! Please ensure: |
119 | | -- Multiple algorithmic approaches when applicable |
120 | | -- Comprehensive test coverage |
121 | | -- Clear documentation with complexity analysis |
122 | | -- Benchmark additions for new problems |
123 | | - |
124 | 5 | ## License |
125 | 6 |
|
126 | 7 | MIT |
127 | 8 |
|
128 | 9 | ## Author |
129 | | - |
130 | | -Built with Rust 🦀 for learning and interview preparation. |
| 10 | +Marvin Tutt, Caia Tech |
| 11 | +Built with Rust 🦀 for learning and interview preparation + AI training |
0 commit comments