My solutions to LeetCode problems, written in Rust.
Solutions are organized by topic. Each topic is a module under src/, and each problem is a separate file within its topic.
src/
├── lib.rs
├── array/
│ ├── mod.rs
│ ├── two_sum.rs
│ └── ...
├── linked_list/
│ ├── mod.rs
│ └── add_two_numbers.rs
├── string/
├── tree/
├── graph/
├── dynamic_programming/
├── binary/
│ ├── mod.rs
│ └── binary_search.rs
└── ...
▓░░░░░░░░░░░░░░░░░░░ 4/75 (5%)
- Two Sum
- Best Time to Buy and Sell Stock
- Contains Duplicate
- Product of Array Except Self
- Maximum Subarray
- Maximum Product Subarray
- Find Minimum in Rotated Sorted Array
- Search in Rotated Sorted Array
- 3Sum
- Container With Most Water
- Sum of Two Integers
- Number of 1 Bits
- Counting Bits
- Missing Number
- Reverse Bits
- Climbing Stairs
- Coin Change
- Longest Increasing Subsequence
- Longest Common Subsequence
- Word Break
- Combination Sum IV
- House Robber
- House Robber II
- Decode Ways
- Unique Paths
- Jump Game
- Clone Graph
- Course Schedule
- Pacific Atlantic Water Flow
- Number of Islands
- Longest Consecutive Sequence
- Alien Dictionary
- Graph Valid Tree
- Number of Connected Components in an Undirected Graph
- Insert Interval
- Merge Intervals
- Non-overlapping Intervals
- Meeting Rooms
- Meeting Rooms II
- Reverse a Linked List
- Detect Cycle in a Linked List
- Merge Two Sorted Lists
- Merge K Sorted Lists
- Remove Nth Node From End of List
- Reorder List
- Set Matrix Zeroes
- Spiral Matrix
- Rotate Image
- Word Search
- Longest Substring Without Repeating Characters
- Longest Repeating Character Replacement
- Minimum Window Substring
- Valid Anagram
- Group Anagrams
- Valid Parentheses
- Valid Palindrome
- Longest Palindromic Substring
- Palindromic Substrings
- Encode and Decode Strings
- Maximum Depth of Binary Tree
- Same Tree
- Invert Binary Tree
- Binary Tree Maximum Path Sum
- Binary Tree Level Order Traversal
- Serialize and Deserialize Binary Tree
- Subtree of Another Tree
- Construct Binary Tree from Preorder and Inorder Traversal
- Validate Binary Search Tree
- Kth Smallest Element in a BST
- Lowest Common Ancestor of a BST
- Implement Trie (Prefix Tree)
- Add and Search Word
- Word Search II
- Merge K Sorted Lists
- Top K Frequent Elements
- Find Median from Data Stream
Solutions outside the Blind 75 list — classic algorithms, warm-ups, or topic detours.
- Binary Search (recursive) —
src/binary/binary_search.rs - Binary Search (iterative) —
src/binary/binary_search.rs - Find the First True in a Sorted Boolean Array —
src/binary/first_true_in_sorted_boolean_array.rs - First Element Not Smaller Than Target —
src/binary/first_element_not_smaller_than_target.rs - Find Element in Sorted Array with Duplicates —
src/binary/find_element_in_sorted_array_with_duplicates.rs - Square Root Estimation —
src/binary/square_root_estimation.rs - Peak Index in a Mountain Array —
src/binary/peak_index_in_mountain_array.rs
Run all tests:
cargo testRun tests for a specific topic:
cargo test arrayRun tests for a specific problem:
cargo test two_sum