LeetCode solutions with time/space complexity and tags.
| Problem | Solution | Time | Space | Tags |
|---|---|---|---|---|
| 0001. Two Sum | ✅Done | O(n) | O(n) | Hashing, 2ptr |
| 0002. Add Two Numbers | ❌None | |||
| 0007. Reverse Integer | O(log n) | O(1) | ||
| 0009. Palindrome Number | ✅Done | O(log n) | O(1) | Math |
| 0013. Roman to Integer | ✅Done | O(1) | O(1) | String, Sliding |
| 0014. Longest Common Prefix | ||||
| 0020. Valid Parentheses | ✅Done | O(n) | O(n) | Stack |
| 0021. Merge Two Sorted Lists | ✅Done | O(m+n) | O(1) | LL, 2ptr |
| 0027. Remove Element | O(n) | O(1) | 2ptr | |
| 0066. Plus One | O(n) | O(1) | Math | |
| 0089. Gray Code | ✅Done | O(2^n) | O(2^n) | Math |
| 0121. Best Time to Buy and Sell Stock | O(n) | O(1) | 2ptr, DP | |
| 0136. Single Number | O(1) | O(1) | Bits | |
| 0217. Contains Duplicate | O(n) | O(n) | Hashing | |
| 0249. Group Shifted Strings | ||||
| 0344. Reverse String | O(n) | O(1) | 2ptr, Recursion | |
| 0628. Maximum Product of Three Numbers | O(n) | O(1) | Greedy | |
| 0692. Top K Frequent Words |
All scripts marked ✅ are clean (Ruff), tested (CI), and accepted (LC).
Hints are numbered as (#) for easy referrals at inline comments.
Scripts may contain more than 1 sol or follow-up Q.
CLI smoke test batch validates all given test cases (plus custom edge cases) for all solutions presented.
> python ~/Git/leetcode/0001.py --> ✅ (if all solutions pass all testcases)
This project is licensed under the BSD 3-Clause License.