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
βββ Solution.md # Solution explanation and approach
βββ {problem_id}-{problem_name}.ts # TypeScript solution implementation
- Navigate to the problem directory you're interested in
- Read the
README.mdfor problem description and constraints - Check the
Solution.mdfor detailed solution explanation, approach, and complexity analysis - Review the
{problem_id}-{problem_name}.tsfile for the TypeScript implementation
π Arrays
Prefix Sum & Subarray/Product Problems
- [0713. Subarray Product Less Than K](./0713-subarray-product-less-than-k/) - [1590. Make Sum Divisible By P](./1590-make-sum-divisible-by-p/) - [2110. Number Of Smooth Descent Periods Of A Stock](./2110-number-of-smooth-descent-periods-of-a-stock/) - [2348. Number Of Zero Filled Subarrays](./2348-number-of-zero-filled-subarrays/) - [2483. Minimum Penalty For A Shop](./2483-minimum-penalty-for-a-shop/) - [3010. Divide An Array Into Subarrays With Minimum Cost I](./3010-divide-an-array-into-subarrays-with-minimum-cost-i/) - [3013. Divide An Array Into Subarrays With Minimum Cost Ii](./3013-divide-an-array-into-subarrays-with-minimum-cost-ii/) - [3318. Find X Sum Of All K Long Subarrays I](./3318-find-x-sum-of-all-k-long-subarrays-i/) - [3321. Find X Sum Of All K Long Subarrays Ii](./3321-find-x-sum-of-all-k-long-subarrays-ii/) - [3349. Adjacent Increasing Subarrays Detection I](./3349-adjacent-increasing-subarrays-detection-i/) - [3350. Adjacent Increasing Subarrays Detection Ii](./3350-adjacent-increasing-subarrays-detection-ii/) - [3381. Maximum Subarray Sum With Length Divisible By K](./3381-maximum-subarray-sum-with-length-divisible-by-k/) - [3539. Find Sum of Array Product of Magical Sequences](./3539-find-sum-of-array-product-of-magical-sequences/) - [3542. Minimum Operations to Convert All Elements to Zero](./3542-minimum-operations-to-convert-all-elements-to-zero/) - [3587. Minimum Adjacent Swaps To Alternate Parity](./3587-minimum-adjacent-swaps-to-alternate-parity/) - [3599. Partition Array To Minimize Xor](./3599-partition-array-to-minimize-xor/) - [3689. Maximum Total Subarray Value I](./3689-maximum-total-subarray-value-i/) - [3719. Longest Balanced Subarray I](./3719-longest-balanced-subarray-i/) - [3748. Count Stable Subarrays](./3748-count-stable-subarrays/) - [3768. Minimum Inversion Count In Subarrays Of Fixed Length](./3768-minimum-inversion-count-in-subarrays-of-fixed-length/) - [3788. Maximum Score Of A Split](./3788-maximum-score-of-a-split/) - [3795. Minimum Subarray Length With Distinct Sum At Least K](./3795-minimum-subarray-length-with-distinct-sum-at-least-k/) - [3803. Count Residue Prefixes](./3803-count-residue-prefixes/) - [3804. Number Of Centered Subarrays](./3804-number-of-centered-subarrays/) - [3835. Count Subarrays With Cost Less Than Or Equal To K](./3835-count-subarrays-with-cost-less-than-or-equal-to-k/)Sorting, Pairing & Removal
- [0014. Longest Common Prefix](./0014-longest-common-prefix/) - [0026. Remove Duplicates From Sorted Array](./0026-remove-duplicates-from-sorted-array/) - [0049. Group Anagrams](./0049-group-anagrams/) - [0073. Set Matrix Zeroes](./0073-set-matrix-zeroes/) - [0075. Sort Colors](./0075-sort-colors/) - [0744. Find Smallest Letter Greater Than Target](./0744-find-smallest-letter-greater-than-target/) - [0757. Set Intersection Size At Least Two](./0757-set-intersection-size-at-least-two/) - [0869. Reordered Power Of 2](./0869-reordered-power-of-2/) - [0944. Delete Columns To Make Sorted](./0944-delete-columns-to-make-sorted/) - [0955. Delete Columns To Make Sorted Ii](./0955-delete-columns-to-make-sorted-ii/) - [0976. Largest Perimeter Triangle](./0976-largest-perimeter-triangle/) - [1200. Minimum Absolute Difference](./1200-minimum-absolute-difference/) - [1233. Remove Sub Folders From The Filesystem](./1233-remove-sub-folders-from-the-filesystem/) - [1877. Minimize Maximum Pair Sum In Array](./1877-minimize-maximum-pair-sum-in-array/) - [1984. Minimum Difference Between Highest And Lowest Of K Scores](./1984-minimum-difference-between-highest-and-lowest-of-k-scores/) - [2014. Longest Subsequence Repeated K Times](./2014-longest-subsequence-repeated-k-times/) - [2054. Two Best Non Overlapping Events](./2054-two-best-non-overlapping-events/) - [2099. Find Subsequence Of Length K With The Largest Sum](./2099-find-subsequence-of-length-k-with-the-largest-sum/) - [2141. Maximum Running Time Of N Computers](./2141-maximum-running-time-of-n-computers/) - [2300. Successful Pairs Of Spells And Potions](./2300-successful-pairs-of-spells-and-potions/) - [2327. Number Of People Aware Of A Secret](./2327-number-of-people-aware-of-a-secret/) - [2402. Meeting Rooms Iii](./2402-meeting-rooms-iii/) - [2406. Divide Intervals Into Minimum Number Of Groups](./2406-divide-intervals-into-minimum-number-of-groups/) - [2410. Maximum Matching Of Players With Trainers](./2410-maximum-matching-of-players-with-trainers/) - [2616. Minimize The Maximum Difference Of Pairs](./2616-minimize-the-maximum-difference-of-pairs/) - [3074. Apple Redistribution Into Boxes](./3074-apple-redistribution-into-boxes/) - [3075. Maximize Happiness Of Selected Children](./3075-maximize-happiness-of-selected-children/) - [3362. Zero Array Transformation Iii](./3362-zero-array-transformation-iii/) - [3397. Maximum Number Of Distinct Elements After Operations](./3397-maximum-number-of-distinct-elements-after-operations/) - [3424. Minimum Cost To Make Arrays Identical](./3424-minimum-cost-to-make-arrays-identical/) - [3507. Minimum Pair Removal to Sort Array I](./3507-minimum-pair-removal-to-sort-array-i/) - [3510. Minimum Pair Removal to Sort Array II](./3510-minimum-pair-removal-to-sort-array-ii/) - [3536. Maximum Product of Two Digits](./3536-maximum-product-of-two-digits/) - [3538. Merge Operations For Minimum Travel Time](./3538-merge-operations-for-minimum-travel-time/) - [3551. Minimum Swaps To Sort By Digit Sum](./3551-minimum-swaps-to-sort-by-digit-sum/) - [3572. Maximize Ysum By Picking A Triplet Of Distinct Xvalues](./3572-maximize-ysum-by-picking-a-triplet-of-distinct-xvalues/) - [3644. Maximum K To Sort A Permutation](./3644-maximum-k-to-sort-a-permutation/) - [3649. Number Of Perfect Pairs](./3649-number-of-perfect-pairs/) - [3668. Restore Finishing Order](./3668-restore-finishing-order/) - [3727. Maximum Alternating Sum Of Squares](./3727-maximum-alternating-sum-of-squares/) - [3767. Maximize Points After Choosing K Tasks](./3767-maximize-points-after-choosing-k-tasks/) - [3774. Absolute Difference Between Maximum And Minimum K Elements](./3774-absolute-difference-between-maximum-and-minimum-k-elements/) - [3814. Maximum Capacity Within Budget](./3814-maximum-capacity-within-budget/) - [3836. Maximum Score Using Exactly K Pairs](./3836-maximum-score-using-exactly-k-pairs/)Counting, Frequency & Miscellaneous
Counting & Frequency
- 0961. N Repeated Element In Size 2n Array
- 1128. Number Of Equivalent Domino Pairs
- 1498. Number of Subsequences That Satisfy the Given Sum Condition
- 1504. Count Submatrices With All Ones
- 1733. Minimum Number Of People To Teach
- 1751. Maximum Number Of Events That Can Be Attended Ii
- 2147. Number Of Ways To Divide A Long Corridor
- 2210. Count Hills And Valleys In An Array
- 2406. Divide Intervals Into Minimum Number of Groups
- 2409. Count Days Spent Together
- 2549. Count Distinct Numbers On Board
- 3005. Count Elements With Maximum Frequency
- 3289. The Two Sneaky Numbers Of Digitville
- 3343. Count Number Of Balanced Permutations
- 3346. Maximum Frequency Of An Element After Performing Operations I
- 3347. Maximum Frequency Of An Element After Performing Operations Ii
- 3405. Count The Number Of Arrays With K Matching Adjacent Elements
- 3432. Count Partitions With Even Sum Difference
- 3442. Maximum Difference Between Even And Odd Frequency I
- 3448. Count Substrings Divisible By Last Digit
- 3514. Number Of Unique Xor Triplets Ii
- 3527. Find The Most Common Response
- 3529. Count Cells in Overlapping Horizontal and Vertical Substrings
- 3531. Count Covered Buildings
- 3569. Maximize Count Of Distinct Primes After Split
- 3577. Count The Number Of Computer Unlocking Permutations
- 3578. Count Partitions With Max Min Difference At Most K
- 3583. Count Special Triplets
- 3589. Count Prime Gap Balanced Subarrays
- 3591. Check If Any Element Has Prime Frequency
- 3649. Number Of Perfect Pairs
- 3663. Find The Least Frequent Digit
- 3692. Majority Frequency Characters
- 3704. Count No Zero Pairs That Sum To N
- 3729. Count Distinct Subarrays Divisible By K In Sorted Array
- 3737. Count Subarrays With Majority Element I
- 3747. Count Distinct Integers After Removing Zeros
- 3759. Count Elements With At Least K Greater Values
- 3833. Count Dominant Indices
Operations & Transformations
- 0066. Plus One
- 1290. Convert Binary Number in a Linked List to Integer
- 1298. Maximum Candies You Can Get from Boxes
- 1323. Maximum 69 Number
- 1526. Minimum Number Of Increments On Subarrays To Form A Target Array
- 1578. Minimum Time To Make Rope Colorful
- 1695. Maximum Erasure Value
- 1717. Maximum Score From Removing Substrings
- 1792. Maximum Average Pass Ratio
- 2016. Maximum Difference Between Increasing Elements
- 2163. Minimum Difference in Sums After Removal of Elements
- 2211. Count Collisions On A Road
- 2294. Partition Array Such That Maximum Difference Is K
- 2410. Maximum Matching of Players With Trainers
- 2411. Smallest Subarrays With Maximum Bitwise OR
- 2528. Maximize The Minimum Powered City
- 2566. Maximum Difference by Remapping a Digit
- 2616. Minimize the Maximum Difference of Pairs
- 2918. Minimum Equal Sum of Two Arrays After Replacing Zeros
- 3085. Minimum Deletions To Make String K Special
- 3190. Find Minimum Operations To Make All Elements Divisible By Three
- 3201. Find The Maximum Length Of Valid Subsequence I
- 3202. Find The Maximum Length Of Valid Subsequence Ii
- 3354. Make Array Elements Equal To Zero
- 3355. Zero Array Transformation I
- 3379. Transformed Array
- 3411. Maximum Subarray with Equal Products
- 3423. Maximum Difference Between Adjacent Elements In A Circular Array
- 3424. Minimum Cost to Make Arrays Identical
- 3439. Reschedule Meetings for Maximum Free Time I
- 3440. Reschedule Meetings for Maximum Free Time II
- 3480. Maximize Subarrays After Removing One Conflicting Pair
- 3487. Maximum Unique Subarray Sum After Deletion
- 3494. Find The Minimum Amount Of Time To Brew Potions
- 3495. Minimum Operations To Make Array Elements Zero
- 3502. Minimum Cost To Reach Every Position
- 3505. Minimum Operations To Make Elements Within K Subarrays Equal
- 3509. Maximum Product Of Subsequences With An Alternating Sum Equal To K
- 3512. Minimum Operations to Make Array Sum Divisible by K
- 3542. Minimum Operations To Convert All Elements To Zero
- 3543. Maximum Weighted K Edge Path
- 3545. Minimum Deletions For At Most K Distinct Characters
- 3567. Minimum Absolute Difference in Sliding Submatrix
- 3568. Minimum Moves To Clean The Classroom
- 3572. Maximize Y Sum by Picking a Triplet of Distinct X Values
- 3576. Transform Array To All Equal Elements
- 3584. Maximum Product of First and Last Elements of a Subsequence
- 3587. Minimum Adjacent Swaps to Alternate Parity
- 3588. Find Maximum Area Of A Triangle
- 3605. Minimum Stability Factor of Array
- 3609. Minimum Moves To Reach Target In Grid
- 3634. Minimum Removals To Balance Array
- 3644. Maximum K To Sort A Permutation
- 3674. Minimum Operations To Equalize Array
- 3679. Minimum Discards To Balance Inventory
- 3689. Maximum Total Subarray Value I
- 3698. Split Array With Minimum Difference
- 3724. Minimum Operations To Transform Array
- 3736. Minimum Moves To Equal Array Elements Iii
- 3745. Maximize Expression Of Three Elements
- 3762. Minimum Operations To Equalize Subarrays
- 3776. Minimum Moves To Balance Circular Array
- 3779. Minimum Number Of Operations To Have Distinct Elements
- 3785. Minimum Swaps To Avoid Forbidden Values
- 3809. Best Reachable Tower
- 3810. Minimum Operations To Reach Target Array
- 3818. Minimum Prefix Removal To Make Array Strictly Increasing
- 3819. Rotate Non Negative Elements
- 3824. Minimum K To Reduce Array Within Limit
- 3834. Merge Adjacent Equal Elements
General Array Problems
General Array Problems
- 0001. Two Sum
- 0002. Add Two Numbers
- 0118. Pascal's Triangle
- 0166. Fraction To Recurring Decimal
- 0440. K Th Smallest In Lexicographical Order
- 0594. Longest Harmonious Subsequence
- 0679. 24 Game
- 0717. 1 Bit And 2 Bit Characters
- 0767. Reorganize String
- 0808. Soup Servings
- 0904. Fruit Into Baskets
- 1304. Find N Unique Integers Sum Up To Zero
- 1394. Find Lucky Integer In An Array
- 1470. Shuffle The Array
- 1488. Avoid Flood In The City
- 1518. Water Bottles
- 1550. Three Consecutive Odds
- 1865. Finding Pairs With a Certain Sum
- 1900. The Earliest And Latest Rounds Where Players Compete
- 1920. Build Array from Permutation
- 1929. Concatenation Of Array
- 1930. Unique Length 3 Palindromic Subsequences
- 1931. Painting A Grid With Three Different Colors
- 2040. Kth Smallest Product of Two Sorted Arrays
- 2048. Next Greater Numerically Balanced Number
- 2081. Sum of k-Mirror Numbers
- 2094. Finding 3-Digit Even Numbers
- 2115. Find All Possible Recipes From Given Supplies
- 2131. Longest Palindrome By Concatenating Two Letter Words
- 2138. Divide a String Into Groups of Size k
- 2154. Keep Multiplying Found Values By Two
- 2200. Find All K-Distant Indices in an Array
- 2235. Add Two Integers
- 2300. Successful Pairs Of Spells And Potions
- 2402. Meeting Rooms III
- 2425. Bitwise XOR of All Pairings
- 2561. Rearranging Fruits
- 2605. Form Smallest Number From Two Digit Arrays
- 2894. Divisible and Non-divisible Sums Difference
- 2900. Longest Unequal Adjacent Groups Subsequence I
- 2901. Longest Unequal Adjacent Groups Subsequence Ii
- 2943. Maximize Area Of Square Hole In Grid
- 2966. Divide Array Into Arrays With Max Difference
- 2975. Maximum Square Area By Removing Fences From A Field
- 3100. Water Bottles Ii
- 3438. Find Valid Pair Of Adjacent Digits In String
- 3447. Assign Elements To Groups With Constraints
- 3479. Fruits into Baskets III
- 3508. Implement Router
- 3516. Find Closest Person
- 3528. Unit Conversion I
- 3533. Concatenated Divisibility
- 3534. Path Existence Queries In A Graph Ii
- 3537. Fill a Special Grid
- 3539. Find Sum Of Array Product Of Magical Sequences
- 3541. Find Most Frequent Vowel And Consonant
- 3544. Subtree Inversion Sum
- 3566. Partition Array into Two Equal Product Subsets
- 3573. Best Time To Buy And Sell Stock V
- 3590. Kth Smallest Path Xor Sum
- 3592. Inverse Coin Change
- 3606. Coupon Code Validator
- 3637. Trionic Array I
- 3640. Trionic Array Ii
- 3664. Two Letter Card Game
- 3668. Restore Finishing Order
- 3669. Balanced K Factor Decomposition
- 3694. Distinct Points Reachable After Substring Removal
- 3701. Compute Alternating Sum
- 3718. Smallest Missing Multiple Of K
- 3728. Stable Subarrays With Equal Boundary And Interior Sum
- 3731. Find Missing Elements
- 3732. Maximum Product Of Three Elements After One Replacement
- 3782. Last Remaining Integer After Alternating Deletion Operations
Matrix Problems
- [0036. Valid Sudoku](./0036-valid-sudoku/) - [0054. Spiral Matrix](./0054-spiral-matrix/) - [0059. Spiral Matrix II](./0059-spiral-matrix-ii/) - [0073. Set Matrix Zeroes](./0073-set-matrix-zeroes/) - [0085. Maximal Rectangle](./0085-maximal-rectangle/) - [0200. Number Of Islands](./0200-number-of-islands/) - [0407. Trapping Rain Water Ii](./0407-trapping-rain-water-ii/) - [0417. Pacific Atlantic Water Flow](./0417-pacific-atlantic-water-flow/) - [0778. Swim In Rising Water](./0778-swim-in-rising-water/) - [0885. Spiral Matrix III](./0885-spiral-matrix-iii/) - [1292. Maximum Side Length Of A Square With Sum Less Than Or Equal To Threshold](./1292-maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold/) - [1895. Largest Magic Square](./1895-largest-magic-square/) - [1975. Maximum Matrix Sum](./1975-maximum-matrix-sum/) - [2257. Count Unguarded Cells In The Grid](./2257-count-unguarded-cells-in-the-grid/) - [2326. Spiral Matrix IV](./2326-spiral-matrix-iv/) - [2435. Paths In Matrix Whose Sum Is Divisible By K](./2435-paths-in-matrix-whose-sum-is-divisible-by-k/) - [2536. Increment Submatrices By One](./2536-increment-submatrices-by-one/) - [3000. Maximum Area Of Longest Diagonal Rectangle](./3000-maximum-area-of-longest-diagonal-rectangle/) - [3047. Find The Largest Area Of Square Inside Two Rectangles](./3047-find-the-largest-area-of-square-inside-two-rectangles/) - [3195. Find The Minimum Area To Cover All Ones I](./3195-find-the-minimum-area-to-cover-all-ones-i/) - [3341. Find Minimum Time To Reach Last Room I](./3341-find-minimum-time-to-reach-last-room-i/) - [3342. Find Minimum Time To Reach Last Room Ii](./3342-find-minimum-time-to-reach-last-room-ii/) - [3363. Find The Maximum Number Of Fruits Collected](./3363-find-the-maximum-number-of-fruits-collected/) - [3426. Manhattan Distances Of All Arrangements Of Pieces](./3426-manhattan-distances-of-all-arrangements-of-pieces/) - [3446. Sort Matrix by Diagonals](./3446-sort-matrix-by-diagonals/) - [3453. Separate Squares I](./3453-separate-squares-i/) - [3454. Separate Squares Ii](./3454-separate-squares-ii/) - [3459. Length Of Longest V Shaped Diagonal Segment](./3459-length-of-longest-v-shaped-diagonal-segment/) - [3529. Count Cells In Overlapping Horizontal And Vertical Substrings](./3529-count-cells-in-overlapping-horizontal-and-vertical-substrings/) - [3537. Fill A Special Grid](./3537-fill-a-special-grid/) - [3552. Grid Teleportation Traversal](./3552-grid-teleportation-traversal/) - [3567. Minimum Absolute Difference In Sliding Submatrix](./3567-minimum-absolute-difference-in-sliding-submatrix/) - [3603. Minimum Cost Path With Alternating Directions Ii](./3603-minimum-cost-path-with-alternating-directions-ii/) - [3623. Count Number Of Trapezoids I](./3623-count-number-of-trapezoids-i/) - [3625. Count Number Of Trapezoids Ii](./3625-count-number-of-trapezoids-ii/) - [3643. Flip Square Submatrix Vertically](./3643-flip-square-submatrix-vertically/)Two-Pointer & Sliding Window
- [0011. Container With Most Water](./0011-container-with-most-water/) - [0013. Roman To Integer](./0013-roman-to-integer/) - [0015. 3Sum](./0015-3sum/) - [0120. Triangle](./0120-triangle/) - [0135. Candy](./0135-candy/) - [0165. Compare Version Numbers](./0165-compare-version-numbers/) - [0326. Power Of Three](./0326-power-of-three/) - [0837. New 21 Game](./0837-new-21-game/) - [0904. Fruit Into Baskets](./0904-fruit-into-baskets/) - [1249. Minimum Remove to Make Valid Parentheses](./1249-minimum-remove-to-make-valid-parentheses/) - [1353. Maximum Number Of Events That Can Be Attended](./1353-maximum-number-of-events-that-can-be-attended/) - [1493. Longest Subarray Of 1s After Deleting One Element](./1493-longest-subarray-of-1s-after-deleting-one-element/) - [1498. Number Of Subsequences That Satisfy The Given Sum Condition](./1498-number-of-subsequences-that-satisfy-the-given-sum-condition/) - [1695. Maximum Erasure Value](./1695-maximum-erasure-value/) - [1751. Maximum Number Of Events That Can Be Attended Ii](./1751-maximum-number-of-events-that-can-be-attended-ii/) - [2040. Kth Smallest Product Of Two Sorted Arrays](./2040-kth-smallest-product-of-two-sorted-arrays/) - [2163. Minimum Difference In Sums After Removal Of Elements](./2163-minimum-difference-in-sums-after-removal-of-elements/) - [2438. Range Product Queries Of Powers](./2438-range-product-queries-of-powers/) - [3021. Alice And Bob Playing Flower Game](./3021-alice-and-bob-playing-flower-game/) - [3027. Find The Number Of Ways To Place People Ii](./3027-find-the-number-of-ways-to-place-people-ii/) - [3197. Find The Minimum Area To Cover All Ones Ii](./3197-find-the-minimum-area-to-cover-all-ones-ii/) - [3439. Reschedule Meetings For Maximum Free Time I](./3439-reschedule-meetings-for-maximum-free-time-i/) - [3477. Fruits Into Baskets Ii](./3477-fruits-into-baskets-ii/) - [3479. Fruits Into Baskets Iii](./3479-fruits-into-baskets-iii/) - [3608. Minimum Time For K Connected Components](./3608-minimum-time-for-k-connected-components/) - [3690. Split And Merge Array Transformation](./3690-split-and-merge-array-transformation/) - [3698. Split Array With Minimum Difference](./3698-split-array-with-minimum-difference/) - [3727. Maximum Alternating Sum Of Squares](./3727-maximum-alternating-sum-of-squares/)Dynamic Programming
- [0474. Ones And Zeroes](./0474-ones-and-zeroes/) - [0712. Minimum Ascii Delete Sum For Two Strings](./0712-minimum-ascii-delete-sum-for-two-strings/) - [0756. Pyramid Transition Matrix](./0756-pyramid-transition-matrix/) - [0790. Domino and Tromino Tiling](./0790-domino-and-tromino-tiling/) - [0799. Champagne Tower](./0799-champagne-tower/) - [0960. Delete Columns To Make Sorted Iii](./0960-delete-columns-to-make-sorted-iii/) - [1039. Minimum Score Triangulation Of Polygon](./1039-minimum-score-triangulation-of-polygon/) - [1125. Smallest Sufficient Team](./1125-smallest-sufficient-team/) - [1262. Greatest Sum Divisible By Three](./1262-greatest-sum-divisible-by-three/) - [1411. Number Of Ways To Paint N 3 Grid](./1411-number-of-ways-to-paint-n-3-grid/) - [1432. Max Difference You Can Get From Changing an Integer](./1432-max-difference-you-can-get-from-changing-an-integer/) - [1458. Max Dot Product Of Two Subsequences](./1458-max-dot-product-of-two-subsequences/) - [1653. Minimum Deletions To Make String Balanced](./1653-minimum-deletions-to-make-string-balanced/) - [2787. Ways To Express An Integer As Sum Of Powers](./2787-ways-to-express-an-integer-as-sum-of-powers/) - [2826. Sorting Three Groups](./2826-sorting-three-groups/) - [3202. Find The Maximum Length Of Valid Subsequence Ii](./3202-find-the-maximum-length-of-valid-subsequence-ii/) - [3573. Best Time To Buy And Sell Stock V](./3573-best-time-to-buy-and-sell-stock-v/) - [3592. Inverse Coin Change](./3592-inverse-coin-change/) - [3652. Best Time To Buy And Sell Stock Using Strategy](./3652-best-time-to-buy-and-sell-stock-using-strategy/) - [3693. Climbing Stairs Ii](./3693-climbing-stairs-ii/) - [3751. Total Waviness Of Numbers In Range I](./3751-total-waviness-of-numbers-in-range-i/) - [3771. Total Score Of Dungeon Runs](./3771-total-score-of-dungeon-runs/) - [3789. Minimum Cost To Acquire Required Items](./3789-minimum-cost-to-acquire-required-items/) - [3791. Number Of Balanced Integers In A Range](./3791-number-of-balanced-integers-in-a-range/) - [3796. Find Maximum Value In A Constrained Sequence](./3796-find-maximum-value-in-a-constrained-sequence/) - [3797. Count Routes To Climb A Rectangular Grid](./3797-count-routes-to-climb-a-rectangular-grid/) - [3800. Minimum Cost To Make Two Binary Strings Equal](./3800-minimum-cost-to-make-two-binary-strings-equal/) - [3801. Minimum Cost To Merge Sorted Lists](./3801-minimum-cost-to-merge-sorted-lists/) - [3811. Number Of Alternating Xor Partitions](./3811-number-of-alternating-xor-partitions/) - [3825. Longest Strictly Increasing Subsequence With Non Zero Bitwise And](./3825-longest-strictly-increasing-subsequence-with-non-zero-bitwise-and/) - [3826. Minimum Partition Score](./3826-minimum-partition-score/) - [3840. House Robber V](./3840-house-robber-v/)π€ Strings
Lexicographical & Ordering
- 0386. Lexicographical Numbers
- 1061. Lexicographically Smallest Equivalent String
- 2434. Using a Robot to Print the Lexicographically Smallest String
- 3170. Lexicographically Minimum String After Removing Stars
- 3403. Find the Lexicographically Largest String from the Box I
- 3722. Lexicographically Smallest String After Reverse
- 3816. Lexicographically Smallest String After Deleting Duplicate Characters
String Transformations & Operations
- 0067. Add Binary
- 1768. Merge Strings Alternately
- 2138. Divide A String Into Groups Of Size K
- 2976. Minimum Cost To Convert String I
- 2977. Minimum Cost To Convert String Ii
- 3228. Maximum Number Of Operations To Move Ones To The End
- 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
- 3675. Minimum Operations To Transform String
- 3746. Minimum String Length After Balanced Removals
- 3750. Minimum Number Of Flips To Reverse Binary String
- 3777. Minimum Deletions To Make Alternating Substring
- 3784. Minimum Deletion Cost To Make All Characters Equal
- 3794. Reverse String Prefix
- 3823. Reverse Letters Then Special Characters In A String
- 3838. Weighted Word Mapping
Palindromes & Subsequences
- 1930. Unique Length-3 Palindromic Subsequences
- 2131. Longest Palindrome by Concatenating Two Letter Words
- 2311. Longest Binary Subsequence Less Than or Equal to K
- 3504. Longest Palindrome After Substring Concatenation II
- 3517. Smallest Palindromic Rearrangement I
- 3702. Longest Subsequence With Non Zero Bitwise Xor
- 3766. Minimum Operations To Make Binary Palindrome
Vowels & Character Patterns
String Matching & Substrings
- 1717. Maximum Score From Removing Substrings
- 3085. Minimum Deletions to Make String K-Special
- 3234. Count The Number Of Substrings With Dominant Ones
- 3448. Count Substrings Divisible by Last Digit
- 3545. Minimum Deletions for at Most K Distinct Characters
- 3557. Find Maximum Number of Non-Intersecting Substrings
- 3598. Longest Common Prefix Between Adjacent Strings After Removals
- 3703. Remove K Balanced Substrings
- 3707. Equal Score Substrings
- 3713. Longest Balanced Substring I
- 3760. Maximum Substrings With Distinct Start
- 3761. Minimum Absolute Distance Between Mirror Pairs
- 3799. Word Squares Ii
- 3805. Count Caesar Cipher Pairs
- 3839. Number Of Prefix Connected Groups
Digit & Number Strings
- 1323. Maximum 69 Number
- 2264. Largest 3 Same Digit Number In String
- 2566. Maximum Difference By Remapping A Digit
- 3438. Find Valid Pair of Adjacent Digits in String
- 3461. Check If Digits Are Equal In String After Operations I
- 3550. Smallest Index with Digit Sum Equal to Index
- 3551. Minimum Swaps to Sort by Digit Sum
- 3556. Sum of Largest Prime Substrings
- 3697. Compute Decimal Representation
- 3720. Lexicographically Smallest Permutation Greater Than Target
- 3723. Maximize Sum Of Squares Of Digits
- 3726. Remove Zeros In Decimal Representation
- 3798. Largest Even Number
String Games & Encoding
File & Path Operations
Validation & Parsing
Strings & Palindromes
- 0009. Palindrome Number
- 0020. Valid Parentheses
- 0165. Compare Version Numbers
- 0767. Reorganize String
- 1935. Maximum Number Of Words You Can Type
- 2014. Longest Subsequence Repeated k Times
- 2081. Sum Of K Mirror Numbers
- 2264. Largest 3 Same Digit Number In String
- 3136. Valid Word
- 3304. Find the K-th Character in String Game I
- 3307. Find the K-th Character in String Game II
- 3440. Reschedule Meetings For Maximum Free Time Ii
- 3503. Longest Palindrome After Substring Concatenation I
- 3504. Longest Palindrome After Substring Concatenation II
- 3517. Smallest Palindromic Rearrangement I
- 3598. Longest Common Prefix Between Adjacent Strings After Removals
- 3606. Coupon Code Validator
- 3664. Two Letter Card Game
π³ Trees & Graphs
- 0110. Balanced Binary Tree
- 0124. Binary Tree Maximum Path Sum
- 0199. Binary Tree Right Side View
- 0200. Number of Islands
- 0386. Lexicographical Numbers
- 0543. Diameter of Binary Tree
- 0865. Smallest Subtree With All The Deepest Nodes
- 0909. Snakes and Ladders
- 1161. Maximum Level Sum Of A Binary Tree
- 1339. Maximum Product Of Splitted Binary Tree
- 1353. Maximum Number of Events That Can Be Attended
- 1382. Balance A Binary Search Tree
- 1857. Largest Color Value In A Directed Graph
- 1970. Last Day Where You Can Still Cross
- 2092. Find All People With Secret
- 2322. Minimum Score After Removals on a Tree
- 2359. Find Closest Node to Given Two Nodes
- 2561. Rearranging Fruits
- 2872. Maximum Number Of K Divisible Components
- 3068. Find the Maximum Sum of Node Values
- 3217. Delete Nodes From Linked List Present In Array
- 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
- 3516. Find Closest Person
- 3530. Maximum Profit from Valid Topological Order in DAG
- 3532. Path Existence Queries in a Graph I
- 3533. Concatenated Divisibility
- 3534. Path Existence Queries in a Graph II
- 3538. Merge Operations for Minimum Travel Time
- 3543. Maximum Weighted K Edge Path
- 3544. Subtree Inversion Sum
- 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
- 3650. Minimum Cost Path With Edge Reversals
- 3651. Minimum Cost Path With Teleportations
- 3733. Minimum Time To Complete All Deliveries
- 3772. Maximum Subgraph Score In A Tree
- 3786. Total Sum Of Interaction Cost In Tree Groups
- 3812. Minimum Edge Toggles On A Tree
- 3820. Pythagorean Distance Nodes In A Tree
- 3841. Palindromic Path Queries In A Tree
π Hash Tables & Dictionaries
- 0146. LRU Cache
- 0166. Fraction To Recurring Decimal
- 0966. Vowel Spellchecker
- 1366. Rank Teams by Votes
- 1394. Find Lucky Integer in an Array
- 2115. Find All Possible Recipes from Given Supplies
- 3442. Maximum Difference Between Even and Odd Frequency I
- 3445. Maximum Difference Between Even and Odd Frequency II
- 3477. Fruits into Baskets II
π’ Bit Manipulation
- 0231. Power Of Two
- 0342. Power Of Four
- 0869. Reordered Power Of 2
- 1018. Binary Prefix Divisible By 5
- 1611. Minimum One Bit Operations To Make Integers Zero
- 1716. Calculate Money In Leetcode Bank
- 1935. Maximum Number Of Words You Can Type
- 2311. Longest Binary Subsequence Less Than Or Equal To K
- 2411. Smallest Subarrays With Maximum Bitwise Or
- 2425. Bitwise Xor Of All Pairings
- 2918. Minimum Equal Sum Of Two Arrays After Replacing Zeros
- 3003. Maximize The Number Of Partitions After Operations
- 3314. Construct The Minimum Bitwise Array I
- 3315. Construct The Minimum Bitwise Array Ii
- 3349. Adjacent Increasing Subarrays Detection I
- 3370. Smallest Number With All Set Bits
- 3513. Number of Unique XOR Triplets I
- 3514. Number of Unique XOR Triplets II
- 3530. Maximum Profit From Valid Topological Order In Dag
- 3566. Partition Array Into Two Equal Product Subsets
- 3568. Minimum Moves To Clean The Classroom
- 3590. Kth Smallest Path Xor Sum
- 3594. Minimum Time To Transport All Individuals
- 3599. Partition Array To Minimize Xor
- 3604. Minimum Time To Reach Destination In Directed Graph
- 3605. Minimum Stability Factor Of Array
- 3688. Bitwise Or Of Even Numbers In An Array
- 3702. Longest Subsequence With Non Zero Bitwise Xor
- 3769. Sort Integers By Binary Reflection
- 3781. Maximum Score After Binary Swaps
- 3806. Maximum Bitwise And After Increment Operations
- 3821. Find Nth Smallest Integer With K One Bits
π’ Pure Math
- 0002. Add Two Numbers
- 0118. Pascals Triangle
- 0120. Triangle
- 0812. Largest Triangle Area
- 0909. Snakes And Ladders
- 1304. Find N Unique Integers Sum Up To Zero
- 1317. Convert Integer To The Sum Of Two No Zero Integers
- 1390. Four Divisors
- 1523. Count Odd Numbers In An Interval Range
- 1925. Count Square Sum Triples
- 2081. Sum Of K Mirror Numbers
- 2163. Minimum Difference In Sums After Removal Of Elements
- 2169. Count Operations To Obtain Zero
- 2197. Replace Non Coprime Numbers In Array
- 2221. Find Triangular Sum Of An Array
- 2235. Add Two Integers
- 2654. Minimum Number Of Operations To Make All Array Elements Equal To 1
- 2787. Ways To Express An Integer As Sum Of Powers
- 2918. Minimum Equal Sum Of Two Arrays After Replacing Zeros
- 3068. Find The Maximum Sum Of Node Values
- 3411. Maximum Subarray With Equal Products
- 3443. Maximum Manhattan Distance After K Changes
- 3487. Maximum Unique Subarray Sum After Deletion
- 3509. Maximum Product of Subsequences with an Alternating Sum Equal to K
- 3512. Minimum Operations To Make Array Sum Divisible By K
- 3533. Concatenated Divisibility
- 3539. Find Sum Of Array Product Of Magical Sequences
- 3556. Sum Of Largest Prime Substrings
- 3572. Maximize Ysum By Picking A Triplet Of Distinct Xvalues
- 3574. Maximize Subarray Gcd Score
- 3588. Find Maximum Area Of A Triangle
- 3589. Count Prime Gap Balanced Subarrays
- 3591. Check If Any Element Has Prime Frequency
- 3602. Hexadecimal And Hexatrigesimal Conversion
- 3701. Compute Alternating Sum
- 3765. Complete Prime Number
- 3770. Largest Prime From Consecutive Prime Sum
- 3780. Maximum Sum Of Three Numbers Divisible By Three
- 3783. Mirror Distance Of An Integer
- 3790. Smallest All Ones Multiple
πΎ System Design
- 0146. Lru Cache
- 1290. Convert Binary Number In A Linked List To Integer
- 1792. Maximum Average Pass Ratio
- 1865. Finding Pairs With A Certain Sum
- 1912. Design Movie Rental System
- 2043. Simple Bank System
- 2353. Design A Food Rating System
- 3408. Design Task Manager
- 3484. Design Spreadsheet
- 3508. Implement Router
- 3815. Design Auction System
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.