c9326fb06a460ffe5e8ecf1227299d1ea01f942c
LeetCode Solutions
This repository contains my solutions to various LeetCode problems. Each solution is implemented in Python and follows a consistent structure.
📊 Statistics
- Total Problems Solved: 90+
- Languages: Python, TypeScript
- Difficulty Distribution: Easy, Medium, Hard
📁 Solutions Index
🔢 Arrays & Strings
Easy
- 1. Two Sum - Hash Table, Array
- 9. Palindrome Number - Math
- 13. Roman to Integer - Hash Table, Math, String
- 14. Longest Common Prefix - String, Trie
- 20. Valid Parentheses - Stack, String
- 21. Merge Two Sorted Lists - Linked List, Recursion
- 26. Remove Duplicates from Sorted Array - Array, Two Pointers
- 27. Remove Element - Array, Two Pointers
- 28. Find the Index of the First Occurrence in a String - String, Two Pointers
- 35. Search Insert Position - Array, Binary Search
- 66. Plus One - Array, Math
- 69. Sqrt(x) - Math, Binary Search
- 88. Merge Sorted Array - Array, Two Pointers
- 125. Valid Palindrome - String, Two Pointers
- 169. Majority Element - Array, Hash Table, Divide and Conquer
- 202. Happy Number - Hash Table, Math, Two Pointers
- 205. Isomorphic Strings - Hash Table, String
- 217. Contains Duplicate - Array, Hash Table, Sorting
- 219. Contains Duplicate II - Array, Hash Table, Sliding Window
- 242. Valid Anagram - String, Sorting, Hash Table
- 290. Word Pattern - Hash Table, String
- 383. Ransom Note - String, Hash Table, Counting
- 392. Is Subsequence - String, Two Pointers, Dynamic Programming
- 704. Binary Search - Array, Binary Search
- 1200. Minimum Absolute Difference - Array, Sorting
- 2053. Kth Distinct String in an Array - Array, Hash Table, String
- 2441. Largest Positive Integer That Exists With Its Negative - Array, Hash Table, Two Pointers
Medium
- 2. Add Two Numbers - Linked List, Math, Recursion
- 3. Longest Substring Without Repeating Characters - Hash Table, String, Sliding Window
- 3. Longest Substring Without Repeating Characters (TypeScript) - Hash Table, String, Sliding Window
- 4. Median of Two Sorted Arrays - Array, Binary Search, Divide and Conquer
- 5. Longest Palindromic Substring - String, Dynamic Programming
- 6. Zigzag Conversion - String
- 7. Reverse Integer - Math
- 10. Regular Expression Matching - String, Dynamic Programming, Recursion
- 11. Container With Most Water - Array, Two Pointers, Greedy
- 15. 3Sum - Array, Two Pointers, Sorting
- 22. Generate Parentheses - String, Dynamic Programming, Backtracking
- 36. Valid Sudoku - Array, Hash Table, Matrix
- 42. Trapping Rain Water - Array, Two Pointers, Dynamic Programming, Stack
- 45. Jump Game II - Array, Dynamic Programming, Greedy
- 50. Pow(x, n) - Math, Recursion
- 55. Jump Game - Array, Dynamic Programming, Greedy
- 74. Search a 2D Matrix - Array, Binary Search, Matrix
- 80. Remove Duplicates from Sorted Array II - Array, Two Pointers
- 89. Gray Code - Math, Backtracking, Bit Manipulation
- 90. Subsets II - Array, Backtracking, Bit Manipulation
- 91. Decode Ways - String, Dynamic Programming
- 92. Reverse Linked List II - Linked List
- 121. Best Time to Buy and Sell Stock - Array, Dynamic Programming
- 122. Best Time to Buy and Sell Stock II - Array, Dynamic Programming, Greedy
- 128. Longest Consecutive Sequence - Array, Hash Table, Union Find
- 135. Candy - Array, Greedy
- 141. Linked List Cycle - Hash Table, Linked List, Two Pointers
- 149. Max Points on a Line - Array, Hash Table, Math, Geometry
- 150. Evaluate Reverse Polish Notation - Array, Math, Stack
- 153. Find Minimum in Rotated Sorted Array - Array, Binary Search
- 155. Min Stack - Stack, Design
- 167. Two Sum II - Input Array Is Sorted - Array, Two Pointers, Binary Search
- 172. Factorial Trailing Zeroes - Math
- 189. Rotate Array - Array, Math, Two Pointers
- 206. Reverse Linked List - Linked List, Recursion
- 228. Summary Ranges - Array
- 238. Product of Array Except Self - Array, Prefix Sum
- 246. Strobogrammatic Number - Hash Table, Two Pointers, String
- 248. Strobogrammatic Number III - Math, Recursion
- 243. Shortest Word Distance - Array, String
- 244. Shortest Word Distance II - Array, Hash Table, Design, Two Pointers
- 245. Shortest Word Distance III - Array, String
- 875. Koko Eating Bananas - Array, Binary Search
- 990. Satisfiability of Equality Equations - Array, Union Find, Graph
- 1298. Maximum Candies You Can Get from Boxes - Breadth-First Search, Array
- 1820. Maximum Number of Accepted Invitations - Graph, Backtracking
- 2040. Kth Smallest Product of Two Sorted Arrays - Array, Binary Search
- 2116. Check if a Parentheses String Can Be Valid - String, Stack, Greedy
- 2294. Partition Array Such That Maximum Difference Is K - Array, Greedy, Sorting
- 2616. Minimize the Maximum Difference of Pairs - Array, Binary Search, Greedy
- 2966. Divide Array Into Arrays With Max Difference - Array, Greedy, Sorting
- 3442. Maximum Difference Between Even and Odd Frequency I - Array, Hash Table
- 3445. Maximum Difference Between Even and Odd Frequency II - Array, Hash Table
🔗 Linked Lists
- 2. Add Two Numbers - Linked List, Math, Recursion
- 21. Merge Two Sorted Lists - Linked List, Recursion
- 92. Reverse Linked List II - Linked List
- 141. Linked List Cycle - Hash Table, Linked List, Two Pointers
- 206. Reverse Linked List - Linked List, Recursion
🌳 Trees & Graphs
- 1298. Maximum Candies You Can Get from Boxes - Breadth-First Search, Array
- 1820. Maximum Number of Accepted Invitations - Graph, Backtracking
- 990. Satisfiability of Equality Equations - Array, Union Find, Graph
🔍 Binary Search
- 4. Median of Two Sorted Arrays - Array, Binary Search, Divide and Conquer
- 35. Search Insert Position - Array, Binary Search
- 50. Pow(x, n) - Math, Recursion
- 69. Sqrt(x) - Math, Binary Search
- 74. Search a 2D Matrix - Array, Binary Search, Matrix
- 153. Find Minimum in Rotated Sorted Array - Array, Binary Search
- 167. Two Sum II - Input Array Is Sorted - Array, Two Pointers, Binary Search
- 704. Binary Search - Array, Binary Search
- 875. Koko Eating Bananas - Array, Binary Search
- 2040. Kth Smallest Product of Two Sorted Arrays - Array, Binary Search
- 2616. Minimize the Maximum Difference of Pairs - Array, Binary Search, Greedy
🧮 Dynamic Programming
- 5. Longest Palindromic Substring - String, Dynamic Programming
- 10. Regular Expression Matching - String, Dynamic Programming, Recursion
- 22. Generate Parentheses - String, Dynamic Programming, Backtracking
- 42. Trapping Rain Water - Array, Two Pointers, Dynamic Programming, Stack
- 45. Jump Game II - Array, Dynamic Programming, Greedy
- 55. Jump Game - Array, Dynamic Programming, Greedy
- 91. Decode Ways - String, Dynamic Programming
- 121. Best Time to Buy and Sell Stock - Array, Dynamic Programming
- 122. Best Time to Buy and Sell Stock II - Array, Dynamic Programming, Greedy
- 128. Longest Consecutive Sequence - Array, Hash Table, Union Find
- 135. Candy - Array, Greedy
- 392. Is Subsequence - String, Two Pointers, Dynamic Programming
🎯 Two Pointers
- 3. Longest Substring Without Repeating Characters - Hash Table, String, Sliding Window
- 11. Container With Most Water - Array, Two Pointers, Greedy
- 15. 3Sum - Array, Two Pointers, Sorting
- 26. Remove Duplicates from Sorted Array - Array, Two Pointers
- 27. Remove Element - Array, Two Pointers
- 28. Find the Index of the First Occurrence in a String - String, Two Pointers
- 42. Trapping Rain Water - Array, Two Pointers, Dynamic Programming, Stack
- 80. Remove Duplicates from Sorted Array II - Array, Two Pointers
- 88. Merge Sorted Array - Array, Two Pointers
- 125. Valid Palindrome - String, Two Pointers
- 141. Linked List Cycle - Hash Table, Linked List, Two Pointers
- 167. Two Sum II - Input Array Is Sorted - Array, Two Pointers, Binary Search
- 189. Rotate Array - Array, Math, Two Pointers
- 202. Happy Number - Hash Table, Math, Two Pointers
- 219. Contains Duplicate II - Array, Hash Table, Sliding Window
- 243. Shortest Word Distance - Array, String
- 244. Shortest Word Distance II - Array, Hash Table, Design, Two Pointers
- 245. Shortest Word Distance III - Array, String
- 246. Strobogrammatic Number - Hash Table, Two Pointers, String
- 392. Is Subsequence - String, Two Pointers, Dynamic Programming
- 2441. Largest Positive Integer That Exists With Its Negative - Array, Hash Table, Two Pointers
🗃️ Hash Tables
- 1. Two Sum - Hash Table, Array
- 13. Roman to Integer - Hash Table, Math, String
- 20. Valid Parentheses - Stack, String
- 36. Valid Sudoku - Array, Hash Table, Matrix
- 141. Linked List Cycle - Hash Table, Linked List, Two Pointers
- 149. Max Points on a Line - Array, Hash Table, Math, Geometry
- 169. Majority Element - Array, Hash Table, Divide and Conquer
- 202. Happy Number - Hash Table, Math, Two Pointers
- 205. Isomorphic Strings - Hash Table, String
- 217. Contains Duplicate - Array, Hash Table, Sorting
- 219. Contains Duplicate II - Array, Hash Table, Sliding Window
- 242. Valid Anagram - String, Sorting, Hash Table
- 243. Shortest Word Distance - Array, String
- 244. Shortest Word Distance II - Array, Hash Table, Design, Two Pointers
- 246. Strobogrammatic Number - Hash Table, Two Pointers, String
- 290. Word Pattern - Hash Table, String
- 383. Ransom Note - String, Hash Table, Counting
- 128. Longest Consecutive Sequence - Array, Hash Table, Union Find
- 2053. Kth Distinct String in an Array - Array, Hash Table, String
- 2441. Largest Positive Integer That Exists With Its Negative - Array, Hash Table, Two Pointers
- 3442. Maximum Difference Between Even and Odd Frequency I - Array, Hash Table
- 3445. Maximum Difference Between Even and Odd Frequency II - Array, Hash Table
📚 Stacks & Queues
- 20. Valid Parentheses - Stack, String
- 42. Trapping Rain Water - Array, Two Pointers, Dynamic Programming, Stack
- 150. Evaluate Reverse Polish Notation - Array, Math, Stack
- 155. Min Stack - Stack, Design
- 2116. Check if a Parentheses String Can Be Valid - String, Stack, Greedy
🔄 Backtracking
- 22. Generate Parentheses - String, Dynamic Programming, Backtracking
- 89. Gray Code - Math, Backtracking, Bit Manipulation
- 90. Subsets II - Array, Backtracking, Bit Manipulation
- 1820. Maximum Number of Accepted Invitations - Graph, Backtracking
🎲 Greedy
- 11. Container With Most Water - Array, Two Pointers, Greedy
- 45. Jump Game II - Array, Dynamic Programming, Greedy
- 55. Jump Game - Array, Dynamic Programming, Greedy
- 122. Best Time to Buy and Sell Stock II - Array, Dynamic Programming, Greedy
- 135. Candy - Array, Greedy
- 2116. Check if a Parentheses String Can Be Valid - String, Stack, Greedy
- 2294. Partition Array Such That Maximum Difference Is K - Array, Greedy, Sorting
- 2616. Minimize the Maximum Difference of Pairs - Array, Binary Search, Greedy
- 2966. Divide Array Into Arrays With Max Difference - Array, Greedy, Sorting
🔢 Math
- 7. Reverse Integer - Math
- 9. Palindrome Number - Math
- 13. Roman to Integer - Hash Table, Math, String
- 50. Pow(x, n) - Math, Recursion
- 66. Plus One - Array, Math
- 69. Sqrt(x) - Math, Binary Search
- 89. Gray Code - Math, Backtracking, Bit Manipulation
- 149. Max Points on a Line - Array, Hash Table, Math, Geometry
- 172. Factorial Trailing Zeroes - Math
- 189. Rotate Array - Array, Math, Two Pointers
- 202. Happy Number - Hash Table, Math, Two Pointers
- 150. Evaluate Reverse Polish Notation - Array, Math, Stack
🧮 Bit Manipulation
- 89. Gray Code - Math, Backtracking, Bit Manipulation
- 90. Subsets II - Array, Backtracking, Bit Manipulation
🏗️ Design
- 155. Min Stack - Stack, Design
- 244. Shortest Word Distance II - Array, Hash Table, Design, Two Pointers
🔗 Union Find
- 128. Longest Consecutive Sequence - Array, Hash Table, Union Find
- 990. Satisfiability of Equality Equations - Array, Union Find, Graph
📊 Sorting
- 15. 3Sum - Array, Two Pointers, Sorting
- 80. Remove Duplicates from Sorted Array II - Array, Two Pointers
- 88. Merge Sorted Array - Array, Two Pointers
- 1200. Minimum Absolute Difference - Array, Sorting
- 217. Contains Duplicate - Array, Hash Table, Sorting
- 242. Valid Anagram - String, Sorting, Hash Table
- 2294. Partition Array Such That Maximum Difference Is K - Array, Greedy, Sorting
- 2966. Divide Array Into Arrays With Max Difference - Array, Greedy, Sorting
🔄 Recursion
- 2. Add Two Numbers - Linked List, Math, Recursion
- 10. Regular Expression Matching - String, Dynamic Programming, Recursion
- 21. Merge Two Sorted Lists - Linked List, Recursion
- 22. Generate Parentheses - String, Dynamic Programming, Backtracking
- 50. Pow(x, n) - Math, Recursion
- 206. Reverse Linked List - Linked List, Recursion
- 248. Strobogrammatic Number III - Math, Recursion
🎯 Sliding Window
- 3. Longest Substring Without Repeating Characters - Hash Table, String, Sliding Window
- 219. Contains Duplicate II - Array, Hash Table, Sliding Window
📐 Geometry
- 149. Max Points on a Line - Array, Hash Table, Math, Geometry
🔍 Divide and Conquer
- 4. Median of Two Sorted Arrays - Array, Binary Search, Divide and Conquer
- 169. Majority Element - Array, Hash Table, Divide and Conquer
📝 String Manipulation
- 3. Longest Substring Without Repeating Characters - Hash Table, String, Sliding Window
- 5. Longest Palindromic Substring - String, Dynamic Programming
- 6. Zigzag Conversion - String
- 10. Regular Expression Matching - String, Dynamic Programming, Recursion
- 13. Roman to Integer - Hash Table, Math, String
- 14. Longest Common Prefix - String, Trie
- 20. Valid Parentheses - Stack, String
- 22. Generate Parentheses - String, Dynamic Programming, Backtracking
- 28. Find the Index of the First Occurrence in a String - String, Two Pointers
- 125. Valid Palindrome - String, Two Pointers
- 205. Isomorphic Strings - Hash Table, String
- 242. Valid Anagram - String, Sorting, Hash Table
- 246. Strobogrammatic Number - Hash Table, Two Pointers, String
- 248. Strobogrammatic Number III - Math, Recursion
- 290. Word Pattern - Hash Table, String
- 383. Ransom Note - String, Hash Table, Counting
- 392. Is Subsequence - String, Two Pointers, Dynamic Programming
- 91. Decode Ways - String, Dynamic Programming
- 2116. Check if a Parentheses String Can Be Valid - String, Stack, Greedy
📊 Matrix
- 36. Valid Sudoku - Array, Hash Table, Matrix
- 74. Search a 2D Matrix - Array, Binary Search, Matrix
🔢 Counting
- 383. Ransom Note - String, Hash Table, Counting
🌐 Breadth-First Search
- 1298. Maximum Candies You Can Get from Boxes - Breadth-First Search, Array
📈 Progress Tracking
Difficulty Distribution
- Easy: ~40 problems
- Medium: ~45 problems
- Hard: ~5 problems
Top Problem Types
- Arrays & Strings - Most common
- Hash Tables - Frequently used technique
- Two Pointers - Efficient array manipulation
- Binary Search - Optimization problems
- Dynamic Programming - Complex problem solving
🛠️ Solution Structure
Each solution follows a consistent structure:
- Standard library imports
- Type hints for better code clarity
- Solution class with required method
- Clean, readable implementation
- Proper comments and documentation
🎯 Learning Focus Areas
Based on the solutions, key areas of expertise include:
- Array manipulation and two-pointer techniques
- Hash table optimization for lookups
- Binary search for efficient searching
- Dynamic programming for complex problems
- String manipulation and palindrome problems
- Linked list operations and cycle detection
📚 Resources
This index is automatically generated and organized by problem categories and difficulty levels. Each solution includes the relevant tags and techniques used.
Languages
Python
85.3%
Shell
12%
JavaScript
2.7%