Rust Data Structures & Algorithms (DSA)#
A curated collection of Data Structures and Algorithms implemented in Rust, focused on clarity, correctness, and performance.
This repository is intended for:
- Learning Rust through practical problem solving
- Understanding classic DSA concepts
- Preparing for coding interviews
- Practicing idiomatic and safe Rust
Problems#
Blind 75#
Array & Hashing#
- Contains Duplicate [#217] src/array_hashing/contains_duplicate.rs
- Valid Anagram [#242] src/array_hashing/is_anagram.rs
- Two Sum [#1] src/array_hashing/two_sum.rs
- Group Anagrams [#49] src/array_hashing/group_anagrams.rs
- Top K Frequent Elements [#347]
- Encode and Decode Strings [#271]
- Product of Array Except Self [#238]
- Longest Consecutive Sequence [#128]
Two Pointers#
- Valid Palindrome [#125] src/two_pointers/is_palindrome.rs
- 3 Sum [#15] src/two_pointers/three_sum.rs
- Container With Most Water [#11] src/two_pointers/max_area.rs
Sliding Window#
- Best Time to Buy and Sell Stock [#121] src/sliding_window/max_profit.rs
- Longest Substring Without Repeating Characters [#3] src/sliding_window/length_of_longest_substring.rs
- Longest Repeating Character Replacement [#424] src/sliding_window/character_replacement.rs
- Minimum Window Substring [#76] src/sliding_window/min_window.rs
Stack#
- Valid Parentheses [#20] src/stack/is_valid_parentheses.rs
Binary Search#
- Find Minimum In Rotated Sorted Array [#153] src/binary_search/find_min.rs
- Search In Rotated Sorted Array [#33] src/binary_search/search.rs
Linked List#
- Reverse Linked List [#206] src/linked_list/reverse_list.rs
- Merge Two Sorted Lists [#21] src/linked_list/merge_two_lists.rs
- Linked List Cycle [#141] src/linked_list/has_cycle.rs
- Reorder List [#143] src/linked_list/reorder_list.rs
- Remove Nth Node From End of List [#19] src/linked_list/remove_nth_from_end.rs
- Merge K Sorted Lists [#23] src/linked_list/merge_k_lists.rs
Trees#
- Invert Binary Tree [#226] src/trees/invert_tree.rs
- Maximum Depth of Binary Tree [#104] src/trees/max_depth.rs
- Same Tree [#100] src/trees/is_same_tree.rs
- Subtree of Another Tree [#572]
- Lowest Common Ancestor of a Binary Search Tree [#235]
- Binary Tree Level Order Traversal [#102]
- Validate Binary Search Tree [#98]
- Kth Smallest Element In a Bst [#230]
- Construct Binary Tree From Preorder And Inorder Traversal [#105]
- Binary Tree Maximum Path Sum [#124]
- Serialize And Deserialize Binary Tree [#297]
Heap / Priority Queue#
- Find Median From Data Stream [#295]
Backtracking#
Tries#
- Implement Trie Prefix Tree [#208]
- Design Add And Search Words Data Structure [#211]
- Word Search II [#212]
Graphs#
- Number of Islands [#200]
- Clone Graph [#133]
- Pacific Atlantic Water Flow [#417]
- Course Schedule [#207]
- Graph Valid Tree [#261]
- Number of Connected Components In An Undirected Graph [#323]
Advanced Graphs#
- Alien Dictionary [#269]
1-D Dynamic Programming#
- Climbing Stairs [#70]
- House Robber [#198]
- House Robber II [#213]
- Longest Palindromic Substring [#5]
- Palindromic Substrings [#647]
- Decode Ways [#91]
- Coin Change [#322]
- Maximum Product Subarray [#152]
- Word Break [#139]
- Longest Increasing Subsequence [#300]
2-D Dynamic Programming#
Greedy#
Intervals#
- Insert Interval [#57]
- Merge Intervals [#56]
- Non Overlapping Intervals [#435]
- Meeting Rooms [#252]
- Meeting Rooms II [#253]