Skip to content

Solutions to LeetCode written in πŸ¦€ Rust.

License

Notifications You must be signed in to change notification settings

martwz/leetcode-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

63 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LeetCode in Rust

test

LeetCode is a website that has programming-related questions that are designed to be solved in a limited amount of time. This repository is a collection of some of my solutions written in Rust.

Solutions (132)

| No. | Title | Solution | Problem | Difficulty | |:---:|:------|:--------:|:-------:|:----------:| | 1 | Two Sum | Rust | Leetcode | easy | | 2 | Add Two Numbers | Rust | Leetcode | medium | | 3 | Longest Substring Without Repeating Characters | Rust | Leetcode | medium | | 5 | Longest Palindromic Substring | Rust | Leetcode | medium | | 31 | Next Permutation | Rust | Leetcode | medium | | 33 | Search in Rotated Sorted Array | Rust | Leetcode | medium | | 34 | Find First and Last Position of Element in Sorted Array | Rust | Leetcode | medium | | 37 | Sudoku Solver | Rust | Leetcode | hard | | 42 | Trapping Rain Water | Rust | Leetcode | hard | | 49 | Group Anagrams | Rust | Leetcode | medium | | 51 | N-Queens | Rust | Leetcode | hard | | 52 | N-Queens II | Rust | Leetcode | hard | | 54 | Spiral Matrix | Rust | Leetcode | medium | | 55 | Jump Game | Rust | Leetcode | medium | | 56 | Merge Intervals | Rust | Leetcode | medium | | 62 | Unique Paths | Rust | Leetcode | medium | | 70 | Climbing Stairs | Rust | Leetcode | easy | | 72 | Edit Distance | Rust | Leetcode | hard | | 73 | Set Matrix Zeroes | Rust | Leetcode | medium | | 75 | Sort Colors | Rust | Leetcode | medium | | 93 | Restore IP Addresses | Rust | Leetcode | medium | | 94 | Binary Tree Inorder Traversal | Rust | Leetcode | easy | | 100 | Same Tree | Rust | Leetcode | easy | | 103 | Binary Tree Zigzag Level Order Traversal | Rust | Leetcode | medium | | 115 | Distinct Subsequences | Rust | Leetcode | hard | | 123 | Best Time to Buy and Sell Stock III | Rust | Leetcode | hard | | 134 | Gas Station | Rust | Leetcode | medium | | 169 | Majority Element | Rust | Leetcode | easy | | 174 | Dungeon Game | Rust | Leetcode | hard | | 200 | Number of Islands | Rust | Leetcode | medium | | 201 | Bitwise AND of Numbers Range | Rust | Leetcode | medium | | 207 | Course Schedule | Rust | Leetcode | medium | | 208 | Implement Trie (Prefix Tree) | Rust | Leetcode | medium | | 210 | Course Schedule II | Rust | Leetcode | medium | | 212 | Word Search II | Rust | Leetcode | hard | | 230 | Kth Smallest Element in a BST | Rust | Leetcode | medium | | 242 | Valid Anagram | Rust | Leetcode | easy | | 253 | Meeting Rooms II | Rust | Leetcode | medium | | 279 | Perfect Squares | Rust | Leetcode | medium | | 282 | Expression Add Operators | Rust | Leetcode | hard | | 302 | Smallest Rectangle Enclosing Black Pixels | Rust | Leetcode | hard | | 309 | Best Time to Buy and Sell Stock with Cooldown | Rust | Leetcode | medium | | 317 | Shortest Distance from All Buildings | Rust | Leetcode | hard | | 322 | Coin Change | Rust | Leetcode | medium | | 325 | Maximum Size Subarray Sum Equals k | Rust | Leetcode | medium | | 334 | Increasing Triplet Subsequence | Rust | Leetcode | medium | | 337 | House Robber III | Rust | Leetcode | medium | | 350 | Intersection of Two Arrays II | Rust | Leetcode | easy | | 368 | Largest Divisible Subset | Rust | Leetcode | medium | | 374 | Guess Number Higher or Lower | Rust | Leetcode | easy | | 387 | First Unique Character in a String | Rust | Leetcode | easy | | 435 | Non-overlapping Intervals | Rust | Leetcode | medium | | 437 | Path Sum III | Rust | Leetcode | medium | | 442 | Find All Duplicates in an Array | Rust | Leetcode | medium | | 452 | Minimum Number of Arrows to Burst Balloons | Rust | Leetcode | medium | | 463 | Island Perimeter | Rust | Leetcode | easy | | 465 | Optimal Account Balancing | Rust | Leetcode | hard | | 485 | Max Consecutive Ones | Rust | Leetcode | easy | | 495 | Teemo Attacking | Rust | Leetcode | easy | | 496 | Next Greater Element I | Rust | Leetcode | easy | | 516 | Longest Palindromic Subsequence | Rust | Leetcode | medium | | 543 | Diameter of Binary Tree | Rust | Leetcode | easy | | 547 | Number of Provinces | Rust | Leetcode | medium | | 695 | Max Area of Island | Rust | Leetcode | medium | | 696 | Count Binary Substrings | Rust | Leetcode | easy | | 698 | Partition to K Equal Sum Subsets | Rust | Leetcode | medium | | 713 | Subarray Product Less Than K | Rust | Leetcode | medium | | 713 | Subarray Product Less Than K | Rust | Leetcode | medium | | 725 | Split Linked List in Parts | Rust | Leetcode | medium | | 741 | Cherry Pickup | Rust | Leetcode | hard | | 749 | Contain Virus | Rust | Leetcode | hard | | 764 | Largest Plus Sign | Rust | Leetcode | medium | | 774 | Minimize Max Distance to Gas Station | Rust | Leetcode | medium | | 815 | Bus Routes | Rust | Leetcode | hard | | 841 | Keys and Rooms | Rust | Leetcode | medium | | 875 | Koko Eating Bananas | Rust | Leetcode | medium | | 901 | Online Stock Span | Rust | Leetcode | medium | | 922 | Sort Array By Parity II | Rust | Leetcode | easy | | 929 | Unique Email Addresses | Rust | Leetcode | easy | | 930 | Binary Subarrays With Sum | Rust | Leetcode | medium | | 937 | Reorder Data in Log Files | Rust | Leetcode | easy | | 973 | K Closest Points to Origin | Rust | Leetcode | medium | | 986 | Interval List Intersections | Rust | Leetcode | medium | | 991 | Broken Calculator | Rust | Leetcode | medium | | 993 | Cousins in Binary Tree | Rust | Leetcode | easy | | 1008 | Construct Binary Search Tree from Preorder Traversal | Rust | Leetcode | medium | | 1013 | Partition Array Into Three Parts With Equal Sum | Rust | Leetcode | easy | | 1035 | Uncrossed Lines | Rust | Leetcode | medium | | 1041 | Robot Bounded In Circle | Rust | Leetcode | medium | | 1086 | High Five | Rust | Leetcode | easy | | 1134 | Armstrong Number | Rust | Leetcode | easy | | 1135 | Connecting Cities With Minimum Cost | Rust | Leetcode | medium | | 1137 | N-th Tribonacci Number | Rust | Leetcode | easy | | 1143 | Longest Common Subsequence | Rust | Leetcode | medium | | 1161 | Maximum Level Sum of a Binary Tree | Rust | Leetcode | medium | | 1167 | Minimum Cost to Connect Sticks | Rust | Leetcode | medium | | 1197 | Minimum Knight Moves | Rust | Leetcode | medium | | 1216 | Valid Palindrome III | Rust | Leetcode | hard | | 1239 | Maximum Length of a Concatenated String with Unique Characters | Rust | Leetcode | medium | | 1268 | Search Suggestions System | Rust | Leetcode | medium | | 1275 | Find Winner on a Tic Tac Toe Game | Rust | Leetcode | easy | | 1293 | Shortest Path in a Grid with Obstacles Elimination | Rust | Leetcode | hard | | 1315 | Sum of Nodes with Even-Valued Grandparent | Rust | Leetcode | medium | | 1315 | Sum of Nodes with Even-Valued Grandparent | Rust | Leetcode | medium | | 1328 | Break a Palindrome | Rust | Leetcode | medium | | 1400 | Construct K Palindrome Strings | Rust | Leetcode | medium | | 1428 | Leftmost Column with at Least a One | Rust | Leetcode | medium | | 1457 | Pseudo-Palindromic Paths in a Binary Tree | Rust | Leetcode | easy | | 1481 | Least Number of Unique Integers after K Removals | Rust | Leetcode | medium | | 1570 | Dot Product of Two Sparse Vectors | Rust | Leetcode | medium | | 1604 | Alert Using Same Key-Card Three or More Times in a One Hour Period | Rust | Leetcode | medium | | 1710 | Maximum Units on a Truck | Rust | Leetcode | easy | | 1743 | Restore the Array From Adjacent Pairs | Rust | Leetcode | medium | | 1801 | Number of Orders in the Backlog | Rust | Leetcode | medium | | 1861 | Rotating the Box | Rust | Leetcode | medium | | 1962 | Remove Stones to Minimize the Total | Rust | Leetcode | medium | | 2022 | Convert 1D Array Into 2D Array | Rust | Leetcode | easy | | 2023 | Number of Pairs of Strings With Concatenation Equal to Target | Rust | Leetcode | medium | | 2024 | Maximize the Confusion of an Exam | Rust | Leetcode | medium | | 2025 | Maximum Number of Ways to Partition an Array | Rust | Leetcode | hard | | 2027 | Minimum Moves to Convert String | Rust | Leetcode | easy | | 2028 | Find Missing Observations | Rust | Leetcode | medium | | 2032 | Two Out of Three | Rust | Leetcode | easy | | 2033 | Minimum Operations to Make a Uni-Value Grid | Rust | Leetcode | medium | | 2034 | Stock Price Fluctuation | Rust | Leetcode | medium | | 2042 | Check if Numbers Are Ascending in a Sentence | Rust | Leetcode | easy | | 2043 | Simple Bank System | Rust | Leetcode | medium | | 2044 | Count Number of Maximum Bitwise-OR Subsets | Rust | Leetcode | medium | | 2045 | Second Minimum Time to Reach Destination | Rust | Leetcode | hard | | 5885 | Minimum Number of Moves to Seat Everyone | Rust | Leetcode | easy | | 5886 | Remove Colored Pieces if Both Neighbors are the Same Color | Rust | Leetcode | medium | | 5888 | The Time When the Network Becomes Idle | Rust | Leetcode | medium |