/leetcode-problems

🤖 Solutions for programming practice problems on Leetcode

Primary LanguageTypeScriptMIT LicenseMIT

LeetCode Problems

I like solving problems with code, and LeetCode has thousands to choose from! You can also see my full LeetCode profile.

000-499

# Problem Difficulty Language Topics
0001 Two Sum Easy JavaScript array hash table
0006 ZigZag Conversion Medium TypeScript string
0009 Palindrome Number Easy JavaScript math
0011 Container With Most Water Medium TypeScript array two pointers greedy
0014 Longest Common Prefix Easy JavaScript string trie
0026 Remove Duplicates from Sorted Array Easy TypeScript array two pointers
0027 Remove Element Easy TypeScript array two pointers
0028 Find the Index of the First Occurrence in a String Easy TypeScript two pointers string string matching
0058 Length of Last Word Easy TypeScript string 
0066 Plus One Easy TypeScript array math
0068 Text Justification Hard TypeScript array string simulation
0074 Search a 2D Matrix Medium JavaScript array binary search matrix
0075 Sort Colors Medium TypeScript array two pointers sorting
0121 Best Time to Buy and Sell Stock Easy JavaScript array dynamic programming
0125 Valid Palindrome Easy JavaScript two pointers string
0130 Surrounded Regions Medium TypeScript array depth-first search breadth-first search union find matrix
0131 Palindrome Partitioning Medium TypeScript string dynamic programming backtracking
0136 Single Number Easy TypeScript array bit manipulation
0151 Reverse Words in a String Medium TypeScript two pointers string
0169 Majority Element Easy JavaScript array hash table divide and conquer sorting counting
0175 Combine Two Tables Easy T-SQL database
0176 Second Highest Salary Medium T-SQL database
0181 Employees Earning More than their Managers Easy T-SQL database
0202 Happy Number Easy TypeScript hash table math two pointers
0205 Isomorphic Strings Easy TypeScript hash table string
0217 Contains Duplicate Easy JavaScript array hash table sorting
0238 Product of Array Except Self Medium TypeScript array prefix sum
0242 Valid Anagram Easy TypeScript array prefix sum
0260 Single Number III Medium TypeScript array bit manipulation
0283 Move Zeroes Easy TypeScript hash table string sorting
0330 Patching Array Medium TypeScript array greedy
0334 Increasing Triplet Subsequence Medium TypeScript array greedy
0344 Reverse String Easy TypeScript string two pointers
0345 Reverse Vowels of a String Easy TypeScript string two pointers
0350 Intersection of Two Arrays Easy TypeScript array hash table two pointers binary search sorting
0383 Ransom Note Easy TypeScript hash table string counting
0392 Is Subsequence Easy TypeScript two pointers string dynamic programming
0409 Longest Palindrome Easy TypeScript hash table string greedy
0448 Find all Numbers Disappeared in an Array Easy JavaScript array hash table
0463 Island Perimeter Easy TypeScript array depth-first search breadth-first search matrix
0482 License Key Formatting Easy TypeScript string

500-999

# Problem Difficulty Language Topics
0502 IPO Medium TypeScript array greedy sorting heap (priority queue)
0523 Continuous Subarray Sum Hard TypeScript array hash table math prefix sum
0605 Can Place Flowers Easy TypeScript array greedy
0605 Can Place Flowers Easy TypeScript array greedy
0633 Sum of Square Numbers Medium TypeScript math two pointers binary search
0643 Maximum Average Subarray I Easy TypeScript array sliding window
0648 Replace Words Medium TypeScript array hash table string trie
0657 Robot Return to Origin Easy TypeScript string simulation
0724 Find Pivot Index Easy TypeScript array prefix sum
0726 Number of Atoms Hard TypeScript hash table string stack sorting
0748 Shortest Completing Word Easy TypeScript array hash table string
0796 Rotate String Easy TypeScript string string matching
0826 Most Profit Assigning Work Medium TypeScript array two pointers binary search greedy sorting
0846 Hand of Straights Medium TypeScript array hash table greedy sorting
0945 Minimum Increment to Make Array Unique Medium TypeScript array greedy sorting counting
0973 K Closest Points to Origin Medium TypeScript array math divide and conquer geometry sorting heap (priority queue) quickselect
0974 Subarray Sums Divisible by K Medium TypeScript array bit manipulation queue sliding window prefix sum
0995 Minimum Number of K Consecutive Bit Flips Hard TypeScript array hash table graph
0997 Find the Town Judge Easy TypeScript array hash table graph

1000-1499

# Problem Difficulty Language Topics
1002 Find Common Characters Easy TypeScript array hash table string
1004 Max Consecutive Ones III Medium TypeScript array binary search sliding window prefix sum
1013 Partition Array Into Three Parts With Equal Sum Easy TypeScript array greedy
1038 Binary Search Tree to Greater Sum Tree Medium TypeScript tree depth-first search binary search tree binary tree
1051 Height Checker Easy TypeScript array sorting counting list
1052 Grumpy Bookstore Owner Medium TypeScript array sliding window
1071 Greatest Common Divisor of Strings Easy TypeScript math string
1108 Defanging an IP Address Easy TypeScript string
1110 Delete Nodes and Return Forest Medium TypeScript array hash table tree depth-first search binary tree
1122 Relative Sort Array Easy TypeScript array hash table sorting counting sort
1190 Reverse Substrings Between Each Pair of Parentheses Medium TypeScript string stack
1207 Unique Number of Occurrences Easy TypeScript array hash table
1208 Get Equal Substrings Within Budget Medium TypeScript string binary search sliding window prefix sum
1248 Count Number of Nice Subarrays Medium TypeScript array hash table math sliding window
1281 Subtract the Product and Sum of Digits of an Integer Easy TypeScript math
1380 Lucky Numbers in a Matrix Easy TypeScript array matrix
1382 Balance a Binary Search Tree Medium TypeScript divide and conquer greedy tree depth-first search binary search tree binary tree
1404 Number of Steps to Reduce a Number in Binary Representation to One Medium TypeScript string bit manipulation
1431 Kid With the Greatest Number of Candies Easy TypeScript array
1438 Longest Continuous Subarray with Absolute Diff Less than or Equal to Limit Medium TypeScript array queue sliding window heap (priority queue) ordered set monotonic queue
1442 Count Triplets That Can Form Two Arrays of Equal XOR Medium TypeScript array hash table math bit manipulation prefix sum
1456 Maximum Number of Vowels in a Substring of Given Length Medium TypeScript string sliding window
1482 Minimum Number of Days to Make m Bouquets Medium TypeScript array binary search

1500-1999

# Problem Difficulty Language Topics
1509 Minimum Difference Between Largest and Smallest Value in Three Moves Medium TypeScript array greedy sorting
1518 Water Bottles Easy TypeScript math simulation
1530 Number of Good Leaf Nodes Pairs Medium TypeScript tree depth-first search binary tree
1550 Three Consecutive Odds Easy TypeScript array
1552 Magnetic Force Between Two Balls Medium TypeScript array binary search sorting
1579 Remove Max Number of Edges to Keep Graph Fully Traversable Hard TypeScript union find graph
1598 Crawler Log Folder Easy TypeScript array string stack
1605 Find Valid Matrix Given Row and Column Sums Medium TypeScript array greedy matrix
1608 Special Array with X Elements Greater Than or Equal X Easy TypeScript array binary search sorting
1679 Max Number of K Sum Pairs Medium TypeScript array hash table two pointers sorting
1701 Average Waiting Time Medium TypeScript array simulation
1717 Maximum Score from Removing Substrings Medium TypeScript string stack greedy
1732 Find the Highest Altitude Easy TypeScript array prefix sum
1768 Merge Strings Alternately Easy TypeScript two pointers string
1791 Find Center of Star Graph Easy TypeScript graph
1823 Find the Winner of the Circular Game Medium TypeScript array math recursion queue simulation
1860 Incremental Memory Leak Medium TypeScript math simulation

2000-2499

# Problem Difficulty Language Topics
2037 Minimum Number of Moves to Seat Everyone Easy TypeScript array greedy sorting
2057 Smallest Index with Equal Value Easy JavaScript array
2058 Find the Minimum and Maximum Number of Nodes Between Critical Points Medium TypeScript linked list
2096 Step-By-Step Directions From a Binary Tree Node to Another Medium TypeScript string tree depth-first search binary tree
2114 Maximum Number of Words Found in Sentences Easy TypeScript array string
2181 Merge Nodes in Between Zeros Medium TypeScript linked list simulation
2191 All Ancestors of a Node in a Directed Acyclic Graph Medium TypeScript depth-first search breadth-first search graph topological sort
2196 Create Binary Tree From Descriptions Medium TypeScript array hash table tree binary tree
2215 Find the Difference of Two Arrays Easy TypeScript array hash table
2285 Maximum Total Importance of Roads Medium TypeScript greedy graph sorting heap (priority queue)
2300 Successful Pairs of Spells and Potions Medium TypeScript array two pointers binary search sorting
2390 Removing Stars from a String Medium TypeScript string stack simulation
2392 Build a Matrix with Conditions Hard TypeScript array graph topological sort matrix
2404 Most Frequent Even Element Easy TypeScript array hash table counting
2486 Append Characters to String to Make Subsequence Medium TypeScript two pointers string greedy

2500-2999

# Problem Difficulty Language Topics
2582 Pass the Pillow Easy TypeScript math simulation
2605 Form Smallest Number from Two Digit Arrays Easy TypeScript array hash table enumeration
2619 Array Prototype Last Easy JavaScript
2620 Counter Easy JavaScript
2626 Array Reduce Transformation Easy JavaScript
2634 Filter Elements From Array Easy JavaScript
2635 Apply Transform Over Each Element in Array Easy JavaScript
2665 Counter II Easy JavaScript
2667 Create Hello World Function Easy JavaScript
2704 To Be or Not To Be Easy JavaScript
2723 Add Two Promises Medium TypeScript
2727 Is Object Empty Easy JavaScript
2751 Robot Collisions Hard TypeScript array stack sorting simulation

3000+

# Problem Difficulty Language Topics
3110 Score of a String Easy TypeScript string