A collection of LeetCode solutions implemented in TypeScript. This repository contains my solutions to various LeetCode problems, organized by problem ID and name.
Each problem is organized in its own directory following the format:
{problem_id}-{problem_name}/
βββ README.md # Problem description and constraints
βββ {problem_id}-{problem_name}.ts # TypeScript solution implementation
- Navigate to the problem directory you're interested in
- Read the
README.md
for problem description and constraints - Check the
{problem_id}-{problem_name}.ts
file for the TypeScript implementation
π Arrays
- 0713. Subarray Product Less Than K
- 3502. Minimum Cost to Reach Every Position
- 3539. Find Sum of Array Product of Magical Sequences
- 3542. Minimum Operations to Convert All Elements to Zero
- 0073. Set Matrix Zeroes
- 0075. Sort Colors
- 3507. Minimum Pair Removal to Sort Array I
- 3510. Minimum Pair Removal to Sort Array II
- 3536. Maximum Product of Two Digits
- 3538. Merge Operations for Minimum Travel Time
- 3584. Maximum Product of First and Last Elements of a Subsequence
- 3587. Minimum Adjacent Swaps to Alternate Parity
- 0002. Add Two Numbers
- 0118. Pascal's Triangle
- 0135. Candy
- 0594. Longest Harmonious Subsequence
- 1290. Convert Binary Number in a Linked List to Integer
- 1394. Find Lucky Integer in an Array
- 1498. Number of Subsequences That Satisfy the Given Sum Condition
- 1550. Three Consecutive Odds
- 1695. Maximum Erasure Value
- 1717. Maximum Score From Removing Substrings
- 1865. Finding Pairs With a Certain Sum
- 1920. Build Array from Permutation
- 2016. Maximum Difference Between Increasing Elements
- 2081. Sum of k-Mirror Numbers
- 2094. Finding 3-Digit Even Numbers
- 2099. Find Subsequence of Length K With the Largest Sum
- 2138. Divide a String Into Groups of Size k
- 2163. Minimum Difference in Sums After Removal of Elements
- 2200. Find All K-Distant Indices in an Array
- 2210. Count Hills and Valleys in an Array
- 2235. Add Two Integers
- 2294. Partition Array Such That Maximum Difference Is K
- 2402. Meeting Rooms III
- 2406. Divide Intervals Into Minimum Number of Groups
- 2409. Count Days Spent Together
- 2410. Maximum Matching of Players With Trainers
- 2411. Smallest Subarrays With Maximum Bitwise OR
- 2425. Bitwise XOR of All Pairings
- 2566. Maximum Difference by Remapping a Digit
- 2616. Minimize the Maximum Difference of Pairs
- 2894. Divisible and Non-divisible Sums Difference
- 2918. Minimum Equal Sum of Two Arrays After Replacing Zeros
- 2966. Divide Array Into Arrays With Max Difference
- 3439. Reschedule Meetings for Maximum Free Time I
- 3440. Reschedule Meetings for Maximum Free Time II
- 3447. Assign Elements to Groups with Constraints
- 3480. Maximize Subarrays After Removing One Conflicting Pair
- 3487. Maximum Unique Subarray Sum After Deletion
- 3505. Minimum Operations to Make Elements Within K Subarrays Equal
- 3512. Minimum Operations to Make Array Sum Divisible by K
- 3527. Find the Most Common Response
- 3528. Unit Conversion I
- 3529. Count Cells in Overlapping Horizontal and Vertical Substrings
- 3530. Maximum Profit from Valid Topological Order in DAG
- 3531. Count Covered Buildings
- 3533. Concatenated Divisibility
- 3537. Fill a Special Grid
- 3543. Maximum Weighted K Edge Path
- 3544. Subtree Inversion Sum
- 3566. Partition Array into Two Equal Product Subsets
- 3567. Minimum Absolute Difference in Sliding Submatrix
- 3568. Minimum Moves to Clean the Classroom
- 3569. Maximize Count of Distinct Primes After Split
- 3572. Maximize Y Sum by Picking a Triplet of Distinct X Values
- 3576. Transform Array to All Equal Elements
- 3577. Count the Number of Computer Unlocking Permutations
- 3583. Count Special Triplets
- 3588. Find Maximum Area of a Triangle
- 3589. Count Prime Gap Balanced Subarrays
- 3591. Check If Any Element Has Prime Frequency
- 3592. Inverse Coin Change
- 3605. Minimum Stability Factor of Array
- 3609. Minimum Moves to Reach Target in Grid
- 0054. Spiral Matrix
- 0059. Spiral Matrix II
- 0885. Spiral Matrix III
- 2326. Spiral Matrix IV
- 3446. Sort Matrix by Diagonals
- 0015. 3Sum
- 0049. Group Anagrams
- 1249. Minimum Remove to Make Valid Parentheses
- 3411. Maximum Subarray with Equal Products
- 3423. Maximum Difference Between Adjacent Elements in a Circular Array
- 3424. Minimum Cost to Make Arrays Identical
- 3442. Maximum Difference Between Even and Odd Frequency I
- 3443. Maximum Manhattan Distance After K Changes
- 3445. Maximum Difference Between Even and Odd Frequency II
- 0790. Domino and Tromino Tiling
- 1128. Number of Equivalent Domino Pairs
- 1298. Maximum Candies You Can Get from Boxes
- 1432. Max Difference You Can Get From Changing an Integer
- 1931. Painting a Grid With Three Different Colors
- 3343. Count Number of Balanced Permutations
- 3355. Zero Array Transformation I
- 3362. Zero Array Transformation III
- 3405. Count the Number of Arrays With K Matching Adjacent Elements
- 3573. Best Time to Buy and Sell Stock V
π€ Strings
- 0386. Lexicographical Numbers
- 0440. K-th Smallest in Lexicographical Order
- 1061. Lexicographically Smallest Equivalent String
- 1233. Remove Sub-Folders from the Filesystem
- 1768. Merge Strings Alternately
- 1930. Unique Length-3 Palindromic Subsequences
- 1948. Delete Duplicate Folders in System
- 2014. Longest Subsequence Repeated k Times
- 2131. Longest Palindrome by Concatenating Two Letter Words
- 2311. Longest Binary Subsequence Less Than or Equal to K
- 2434. Using a Robot to Print the Lexicographically Smallest String
- 2667. Create Hello World Function
- 2900. Longest Unequal Adjacent Groups Subsequence I
- 2901. Longest Unequal Adjacent Groups Subsequence II
- 2942. Find Words Containing Character
- 3085. Minimum Deletions to Make String K-Special
- 3136. Valid Word
- 3170. Lexicographically Minimum String After Removing Stars
- 3201. Find the Maximum Length of Valid Subsequence I
- 3202. Find the Maximum Length of Valid Subsequence II
- 3304. Find the K-th Character in String Game I
- 3306. Count of Substrings Containing Every Vowel and K Consonants II
- 3307. Find the K-th Character in String Game II
- 3330. Find the Original Typed String I
- 3333. Find the Original Typed String II
- 3335. Total Characters in String After Transformations I
- 3337. Total Characters in String After Transformations II
- 3403. Find the Lexicographically Largest String from the Box I
- 3438. Find Valid Pair of Adjacent Digits in String
- 3448. Count Substrings Divisible by Last Digit
- 3516. Find Closest Person
- 3517. Smallest Palindromic Rearrangement I
- 3545. Minimum Deletions for at Most K Distinct Characters
- 3550. Smallest Index with Digit Sum Equal to Index
- 3551. Minimum Swaps to Sort by Digit Sum
- 3552. Grid Teleportation Traversal
- 3556. Sum of Largest Prime Substrings
- 3557. Find Maximum Number of Non-Intersecting Substrings
- 3582. Generate Tag for Video Caption
- 3597. Partition String
- 3598. Longest Common Prefix Between Adjacent Strings After Removals
- 3602. Hexadecimal and Hexatrigesimal Conversion
- 3606. Coupon Code Validator
π³ Trees & Graphs
- 0124. Binary Tree Maximum Path Sum
- 0199. Binary Tree Right Side View
- 0200. Number of Islands
- 0543. Diameter of Binary Tree
- 0909. Snakes and Ladders
- 1353. Maximum Number of Events That Can Be Attended
- 1751. Maximum Number of Events That Can Be Attended II
- 1857. Largest Color Value in a Directed Graph
- 1900. The Earliest and Latest Rounds Where Players Compete
- 2040. Kth Smallest Product of Two Sorted Arrays
- 2322. Minimum Score After Removals on a Tree
- 2359. Find Closest Node to Given Two Nodes
- 2561. Rearranging Fruits
- 3068. Find the Maximum Sum of Node Values
- 3341. Find Minimum Time to Reach Last Room I
- 3342. Find Minimum Time to Reach Last Room II
- 3372. Maximize the Number of Target Nodes After Connecting Trees I
- 3373. Maximize the Number of Target Nodes After Connecting Trees II
- 3425. Longest Special Path
- 3426. Manhattan Distances of All Arrangements of Pieces
- 3515. Shortest Path in a Weighted Tree
- 3532. Path Existence Queries in a Graph I
- 3534. Path Existence Queries in a Graph II
- 3558. Number of Ways to Assign Edge Weights I
- 3585. Find Weighted Median Node in Tree
- 3590. Kth Smallest Path XOR Sum
- 3593. Minimum Increments to Equalize Leaf Paths
- 3594. Minimum Time to Transport All Individuals
- 3599. Partition Array to Minimize XOR
- 3600. Maximize Spanning Tree Stability with Upgrades
- 3603. Minimum Cost Path with Alternating Directions II
- 3604. Minimum Time to Reach Destination in Directed Graph
- 3607. Power Grid Maintenance
- 3608. Minimum Time for K Connected Components
π Hash Tables & Dictionaries
π’ Math & Bit Manipulation
πΎ System Design
π SQL
While this is primarily my personal collection of solutions, I welcome any suggestions or improvements. Feel free to:
- Report bugs or issues
- Suggest optimizations
- Share alternative solutions
This project is licensed under the MIT License - see the LICENSE file for details.
Solutions are automatically synced using LeetHub 3.0, a Chrome extension that automatically pushes your LeetCode solutions to GitHub.