leetcode
This page documents my attempts at solving LeetCode problems using Rust. It’s synced daily through my personal fork of leetcode-sync; I keep only the latest submission for each problem, and to keep things simple I write the solution intuition directly as a comment in the code. I aim to craft each solution in the most elegant and idiomatic Rust I can manage after studying others’ approaches—though LeetCode doesn’t always make that easy.
problems
- 0001 - Two Sum
- 0002 - Add Two Numbers
- 0009 - Palindrome Number
- 0011 - Container With Most Water
- 0014 - Longest Common Prefix
- 0020 - Valid Parentheses
- 0021 - Merge Two Sorted Lists
- 0022 - Generate Parentheses
- 0023 - Merge k Sorted Lists
- 0026 - Remove Duplicates from Sorted Array
- 0027 - Remove Element
- 0035 - Search Insert Position
- 0042 - Trapping Rain Water
- 0045 - Jump Game II
- 0048 - Rotate Image
- 0053 - Maximum Subarray
- 0055 - Jump Game
- 0056 - Merge Intervals
- 0058 - Length of Last Word
- 0069 - Sqrt(x)
- 0070 - Climbing Stairs
- 0072 - Edit Distance
- 0083 - Remove Duplicates from Sorted List
- 0088 - Merge Sorted Array
- 0100 - Same Tree
- 0101 - Symmetric Tree
- 0102 - Binary Tree Level Order Traversal
- 0103 - Binary Tree Zigzag Level Order Traversal
- 0104 - Maximum Depth of Binary Tree
- 0112 - Path Sum
- 0118 - Pascal's Triangle
- 0121 - Best Time to Buy and Sell Stock
- 0122 - Best Time to Buy and Sell Stock II
- 0125 - Valid Palindrome
- 0136 - Single Number
- 0137 - Single Number II
- 0169 - Majority Element
- 0190 - Reverse Bits
- 0191 - Number of 1 Bits
- 0258 - Add Digits
- 0260 - Single Number III
- 0309 - Best Time to Buy and Sell Stock with Cooldown
- 0396 - Rotate Function
- 0406 - Queue Reconstruction by Height
- 0502 - IPO
- 0575 - Distribute Candies
- 0637 - Average of Levels in Binary Tree
- 0680 - Valid Palindrome II
- 0717 - 1-bit and 2-bit Characters
- 0740 - Delete and Earn
- 0763 - Partition Labels
- 0957 - Prison Cells After N Days
- 0976 - Largest Perimeter Triangle
- 1015 - Smallest Integer Divisible by K
- 1018 - Binary Prefix Divisible By 5