Skip to content

Kaus-code/Leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

706 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leetcode

DSA in C++ after 1st september 25

LeetCode Topics

Array

0011-container-with-most-water
0042-trapping-rain-water
0047-permutations-ii
0066-plus-one
0084-largest-rectangle-in-histogram
0085-maximal-rectangle
0118-pascals-triangle
0120-triangle
0149-max-points-on-a-line
0174-dungeon-game
0198-house-robber
0213-house-robber-ii
0312-burst-balloons
0329-longest-increasing-path-in-a-matrix
0347-top-k-frequent-elements
0354-russian-doll-envelopes
0407-trapping-rain-water-ii
0474-ones-and-zeroes
0498-diagonal-traverse
0506-relative-ranks
0611-valid-triangle-number
0646-maximum-length-of-pair-chain
0695-max-area-of-island
0717-1-bit-and-2-bit-characters
0729-my-calendar-i
0739-daily-temperatures
0759-set-intersection-size-at-least-two
0794-swim-in-rising-water
0830-largest-triangle-area
0934-bitwise-ors-of-subarrays
0940-fruit-into-baskets
0961-n-repeated-element-in-size-2n-array
0967-minimum-falling-path-sum
1018-binary-prefix-divisible-by-5
1121-partition-array-for-maximum-sum
1200-minimum-absolute-difference
1262-greatest-sum-divisible-by-three
1292-maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold
1350-remove-sub-folders-from-the-filesystem
1351-count-negative-numbers-in-a-sorted-matrix
1353-find-resultant-array-after-removing-anagrams
1402-count-square-submatrices-with-all-ones
1458-max-dot-product-of-two-subsequences
1548-check-if-all-1s-are-at-least-length-k-places-away
1612-avoid-flood-in-the-city
1628-count-submatrices-with-all-ones
1669-minimum-cost-to-cut-a-stick
1700-minimum-time-to-make-rope-colorful
1813-maximum-erasure-value
2079-delete-duplicate-folders-in-system
2137-final-value-of-variable-after-performing-operations
2169-simple-bank-system
2170-count-number-of-maximum-bitwise-or-subsets
2229-maximum-fruits-harvested-after-at-most-k-steps
2267-minimum-difference-in-sums-after-removal-of-elements
2307-replace-non-coprime-numbers-in-array
2316-count-hills-and-valleys-in-an-array
2343-count-unguarded-cells-in-the-grid
2400-minimum-score-after-removals-on-a-tree
2432-number-of-zero-filled-subarrays
2498-smallest-subarrays-with-maximum-bitwise-or
2503-longest-subarray-with-maximum-bitwise-and
2529-range-product-queries-of-powers
2625-increment-submatrices-by-one
2975-maximum-square-area-by-removing-fences-from-a-field
3010-divide-an-array-into-subarrays-with-minimum-cost-i
3047-find-the-largest-area-of-square-inside-two-rectangles
3242-count-elements-with-maximum-frequency
3278-find-the-number-of-ways-to-place-people-i
3381-maximum-subarray-sum-with-length-divisible-by-k
3383-taking-maximum-energy-from-the-mystic-dungeon
3437-maximum-total-damage-with-spell-casting
3454-separate-squares-ii
3459-find-the-minimum-area-to-cover-all-ones-ii
3461-find-the-minimum-area-to-cover-all-ones-i
3491-find-the-maximum-length-of-valid-subsequence-ii
3501-delete-nodes-from-linked-list-present-in-array
3510-minimum-pair-removal-to-sort-array-ii
3512-minimum-operations-to-make-array-sum-divisible-by-k
3531-count-covered-buildings
3578-count-partitions-with-max-min-difference-at-most-k
3592-find-x-sum-of-all-k-long-subarrays-ii
3607-power-grid-maintenance
3610-find-x-sum-of-all-k-long-subarrays-i
3612-adjacent-increasing-subarrays-detection-i
3616-make-array-elements-equal-to-zero
3619-adjacent-increasing-subarrays-detection-ii
3620-maximum-number-of-distinct-elements-after-operations
3622-maximum-frequency-of-an-element-after-performing-operations-i
3625-count-number-of-trapezoids-ii
3634-minimum-removals-to-balance-array
3640-trionic-array-ii
3648-find-the-maximum-number-of-fruits-collected
3651-minimum-cost-path-with-teleportations
3733-length-of-longest-v-shaped-diagonal-segment
3744-minimum-operations-to-make-array-elements-zero
3788-maximum-unique-subarray-sum-after-deletion
3789-maximize-subarrays-after-removing-one-conflicting-pair
3790-fruits-into-baskets-ii
3797-design-spreadsheet
3834-minimum-operations-to-convert-all-elements-to-zero
3851-find-sum-of-array-product-of-magical-sequences
3863-power-grid-maintenance

Dynamic Programming

0005-longest-palindromic-substring
0022-generate-parentheses
0042-trapping-rain-water
0062-unique-paths
0070-climbing-stairs
0085-maximal-rectangle
0118-pascals-triangle
0120-triangle
0132-palindrome-partitioning-ii
0174-dungeon-game
0198-house-robber
0213-house-robber-ii
0312-burst-balloons
0329-longest-increasing-path-in-a-matrix
0354-russian-doll-envelopes
0474-ones-and-zeroes
0514-freedom-trail
0646-maximum-length-of-pair-chain
0688-knight-probability-in-chessboard
0712-minimum-ascii-delete-sum-for-two-strings
0826-soup-servings
0934-bitwise-ors-of-subarrays
0967-minimum-falling-path-sum
1121-partition-array-for-maximum-sum
1250-longest-common-subsequence
1262-greatest-sum-divisible-by-three
1402-count-square-submatrices-with-all-ones
1458-max-dot-product-of-two-subsequences
1628-count-submatrices-with-all-ones
1669-minimum-cost-to-cut-a-stick
1700-minimum-time-to-make-rope-colorful
1732-minimum-one-bit-operations-to-make-integers-zero
2267-minimum-difference-in-sums-after-removal-of-elements
2408-number-of-people-aware-of-a-secret
2882-ways-to-express-an-integer-as-sum-of-powers
3233-maximize-the-number-of-partitions-after-operations
3437-maximum-total-damage-with-spell-casting
3491-find-the-maximum-length-of-valid-subsequence-ii
3578-count-partitions-with-max-min-difference-at-most-k
3640-trionic-array-ii
3648-find-the-maximum-number-of-fruits-collected
3651-minimum-cost-path-with-teleportations
3733-length-of-longest-v-shaped-diagonal-segment
3851-find-sum-of-array-product-of-magical-sequences

Heap (Priority Queue)

0347-top-k-frequent-elements
0407-trapping-rain-water-ii
0506-relative-ranks
0794-swim-in-rising-water
1612-avoid-flood-in-the-city
2267-minimum-difference-in-sums-after-removal-of-elements
3510-minimum-pair-removal-to-sort-array-ii
3592-find-x-sum-of-all-k-long-subarrays-ii
3607-power-grid-maintenance
3610-find-x-sum-of-all-k-long-subarrays-i
3650-minimum-cost-path-with-edge-reversals
3678-design-task-manager
3863-power-grid-maintenance

String

0005-longest-palindromic-substring
0022-generate-parentheses
0132-palindrome-partitioning-ii
0166-fraction-to-recurring-decimal
0474-ones-and-zeroes
0514-freedom-trail
0696-count-binary-substrings
0712-minimum-ascii-delete-sum-for-two-strings
0756-pyramid-transition-matrix
1250-longest-common-subsequence
1264-maximum-number-of-words-you-can-type
1302-delete-characters-to-make-fancy-string
1350-remove-sub-folders-from-the-filesystem
1353-find-resultant-array-after-removing-anagrams
1700-minimum-time-to-make-rope-colorful
1747-lexicographically-smallest-string-after-applying-operations
1818-maximum-score-from-removing-substrings
1930-unique-length-3-palindromic-subsequences
2079-delete-duplicate-folders-in-system
2137-final-value-of-variable-after-performing-operations
2211-count-collisions-on-a-road
2346-largest-3-same-digit-number-in-string
2887-sort-vowels-in-a-string
3233-maximize-the-number-of-partitions-after-operations
3479-count-the-number-of-substrings-with-dominant-ones
3493-maximum-number-of-operations-to-move-ones-to-the-end
3797-design-spreadsheet
3872-find-most-frequent-vowel-and-consonant

Depth-First Search

0329-longest-increasing-path-in-a-matrix
0514-freedom-trail
0695-max-area-of-island
0770-couples-holding-hands
0794-swim-in-rising-water
1161-maximum-level-sum-of-a-binary-tree
1339-maximum-product-of-splitted-binary-tree
1350-remove-sub-folders-from-the-filesystem
1747-lexicographically-smallest-string-after-applying-operations
2400-minimum-score-after-removals-on-a-tree
2872-maximum-number-of-k-divisible-components
3607-power-grid-maintenance
3863-power-grid-maintenance

Trie

1350-remove-sub-folders-from-the-filesystem
2079-delete-duplicate-folders-in-system

Linked List

0019-remove-nth-node-from-end-of-list
0141-linked-list-cycle
3501-delete-nodes-from-linked-list-present-in-array
3510-minimum-pair-removal-to-sort-array-ii

Two Pointers

0005-longest-palindromic-substring
0011-container-with-most-water
0019-remove-nth-node-from-end-of-list
0042-trapping-rain-water
0141-linked-list-cycle
0611-valid-triangle-number
0696-count-binary-substrings
3437-maximum-total-damage-with-spell-casting

Hash Table

0141-linked-list-cycle
0149-max-points-on-a-line
0166-fraction-to-recurring-decimal
0347-top-k-frequent-elements
0756-pyramid-transition-matrix
0900-reordered-power-of-2
0940-fruit-into-baskets
0961-n-repeated-element-in-size-2n-array
1264-maximum-number-of-words-you-can-type
1353-find-resultant-array-after-removing-anagrams
1612-avoid-flood-in-the-city
1813-maximum-erasure-value
1930-unique-length-3-palindromic-subsequences
2079-delete-duplicate-folders-in-system
2169-simple-bank-system
2174-next-greater-numerically-balanced-number
2975-maximum-square-area-by-removing-fences-from-a-field
3242-count-elements-with-maximum-frequency
3381-maximum-subarray-sum-with-length-divisible-by-k
3437-maximum-total-damage-with-spell-casting
3501-delete-nodes-from-linked-list-present-in-array
3510-minimum-pair-removal-to-sort-array-ii
3531-count-covered-buildings
3592-find-x-sum-of-all-k-long-subarrays-ii
3607-power-grid-maintenance
3610-find-x-sum-of-all-k-long-subarrays-i
3625-count-number-of-trapezoids-ii
3678-design-task-manager
3788-maximum-unique-subarray-sum-after-deletion
3797-design-spreadsheet
3834-minimum-operations-to-convert-all-elements-to-zero
3863-power-grid-maintenance
3872-find-most-frequent-vowel-and-consonant

Hash Function

2079-delete-duplicate-folders-in-system

Stack

0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0085-maximal-rectangle
0739-daily-temperatures
0901-online-stock-span
1628-count-submatrices-with-all-ones
1818-maximum-score-from-removing-substrings
2211-count-collisions-on-a-road
2307-replace-non-coprime-numbers-in-array
3834-minimum-operations-to-convert-all-elements-to-zero

Monotonic Stack

0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0085-maximal-rectangle
0739-daily-temperatures
0901-online-stock-span
1628-count-submatrices-with-all-ones
3834-minimum-operations-to-convert-all-elements-to-zero

Matrix

0085-maximal-rectangle
0174-dungeon-game
0329-longest-increasing-path-in-a-matrix
0407-trapping-rain-water-ii
0498-diagonal-traverse
0695-max-area-of-island
0794-swim-in-rising-water
0967-minimum-falling-path-sum
1292-maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold
1351-count-negative-numbers-in-a-sorted-matrix
1402-count-square-submatrices-with-all-ones
1628-count-submatrices-with-all-ones
2343-count-unguarded-cells-in-the-grid
2625-increment-submatrices-by-one
3459-find-the-minimum-area-to-cover-all-ones-ii
3461-find-the-minimum-area-to-cover-all-ones-i
3648-find-the-maximum-number-of-fruits-collected
3651-minimum-cost-path-with-teleportations
3733-length-of-longest-v-shaped-diagonal-segment
3797-design-spreadsheet

Sliding Window

0940-fruit-into-baskets
1813-maximum-erasure-value
2229-maximum-fruits-harvested-after-at-most-k-steps
2498-smallest-subarrays-with-maximum-bitwise-or
3479-count-the-number-of-substrings-with-dominant-ones
3578-count-partitions-with-max-min-difference-at-most-k
3592-find-x-sum-of-all-k-long-subarrays-ii
3610-find-x-sum-of-all-k-long-subarrays-i
3622-maximum-frequency-of-an-element-after-performing-operations-i
3634-minimum-removals-to-balance-array

Greedy

0011-container-with-most-water
0611-valid-triangle-number
0646-maximum-length-of-pair-chain
0759-set-intersection-size-at-least-two
0770-couples-holding-hands
1262-greatest-sum-divisible-by-three
1448-maximum-69-number
1612-avoid-flood-in-the-city
1700-minimum-time-to-make-rope-colorful
1818-maximum-score-from-removing-substrings
3493-maximum-number-of-operations-to-move-ones-to-the-end
3620-maximum-number-of-distinct-elements-after-operations
3788-maximum-unique-subarray-sum-after-deletion
3834-minimum-operations-to-convert-all-elements-to-zero

Bit Manipulation

0231-power-of-two
0342-power-of-four
0756-pyramid-transition-matrix
0934-bitwise-ors-of-subarrays
1018-binary-prefix-divisible-by-5
1732-minimum-one-bit-operations-to-make-integers-zero
1930-unique-length-3-palindromic-subsequences
2170-count-number-of-maximum-bitwise-or-subsets
2400-minimum-score-after-removals-on-a-tree
2498-smallest-subarrays-with-maximum-bitwise-or
2503-longest-subarray-with-maximum-bitwise-and
2529-range-product-queries-of-powers
3233-maximize-the-number-of-partitions-after-operations
3744-minimum-operations-to-make-array-elements-zero
3851-find-sum-of-array-product-of-magical-sequences

Tree

1161-maximum-level-sum-of-a-binary-tree
1339-maximum-product-of-splitted-binary-tree
2400-minimum-score-after-removals-on-a-tree
2872-maximum-number-of-k-divisible-components

Segment Tree

0729-my-calendar-i
3454-separate-squares-ii
3789-maximize-subarrays-after-removing-one-conflicting-pair
3790-fruits-into-baskets-ii

Enumeration

0900-reordered-power-of-2
1747-lexicographically-smallest-string-after-applying-operations
1925-count-square-sum-triples
2170-count-number-of-maximum-bitwise-or-subsets
2174-next-greater-numerically-balanced-number
2975-maximum-square-area-by-removing-fences-from-a-field
3010-divide-an-array-into-subarrays-with-minimum-cost-i
3278-find-the-number-of-ways-to-place-people-i
3459-find-the-minimum-area-to-cover-all-ones-ii
3479-count-the-number-of-substrings-with-dominant-ones
3789-maximize-subarrays-after-removing-one-conflicting-pair

Prefix Sum

1292-maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold
1930-unique-length-3-palindromic-subsequences
2229-maximum-fruits-harvested-after-at-most-k-steps
2529-range-product-queries-of-powers
2625-increment-submatrices-by-one
3381-maximum-subarray-sum-with-length-divisible-by-k
3383-taking-maximum-energy-from-the-mystic-dungeon
3578-count-partitions-with-max-min-difference-at-most-k
3616-make-array-elements-equal-to-zero
3622-maximum-frequency-of-an-element-after-performing-operations-i
3789-maximize-subarrays-after-removing-one-conflicting-pair

Sorting

0047-permutations-ii
0347-top-k-frequent-elements
0354-russian-doll-envelopes
0506-relative-ranks
0611-valid-triangle-number
0646-maximum-length-of-pair-chain
0759-set-intersection-size-at-least-two
0900-reordered-power-of-2
1200-minimum-absolute-difference
1262-greatest-sum-divisible-by-three
1353-find-resultant-array-after-removing-anagrams
1669-minimum-cost-to-cut-a-stick
2887-sort-vowels-in-a-string
3010-divide-an-array-into-subarrays-with-minimum-cost-i
3278-find-the-number-of-ways-to-place-people-i
3437-maximum-total-damage-with-spell-casting
3531-count-covered-buildings
3620-maximum-number-of-distinct-elements-after-operations
3622-maximum-frequency-of-an-element-after-performing-operations-i
3634-minimum-removals-to-balance-array

Backtracking

0022-generate-parentheses
0047-permutations-ii
0756-pyramid-transition-matrix
2170-count-number-of-maximum-bitwise-or-subsets
2174-next-greater-numerically-balanced-number

Math

0062-unique-paths
0066-plus-one
0070-climbing-stairs
0149-max-points-on-a-line
0166-fraction-to-recurring-decimal
0231-power-of-two
0326-power-of-three
0342-power-of-four
0826-soup-servings
0830-largest-triangle-area
0900-reordered-power-of-2
1440-convert-integer-to-the-sum-of-two-no-zero-integers
1448-maximum-69-number
1523-count-odd-numbers-in-an-interval-range
1642-water-bottles
1925-count-square-sum-triples
2174-next-greater-numerically-balanced-number
2307-replace-non-coprime-numbers-in-array
2432-number-of-zero-filled-subarrays
3047-find-the-largest-area-of-square-inside-two-rectangles
3278-find-the-number-of-ways-to-place-people-i
3336-water-bottles-ii
3512-minimum-operations-to-make-array-sum-divisible-by-k
3625-count-number-of-trapezoids-ii
3744-minimum-operations-to-make-array-elements-zero
3851-find-sum-of-array-product-of-magical-sequences

Memoization

0070-climbing-stairs
0329-longest-increasing-path-in-a-matrix
1732-minimum-one-bit-operations-to-make-integers-zero
3733-length-of-longest-v-shaped-diagonal-segment

Binary Search

0354-russian-doll-envelopes
0611-valid-triangle-number
0729-my-calendar-i
0794-swim-in-rising-water
1292-maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold
1351-count-negative-numbers-in-a-sorted-matrix
1612-avoid-flood-in-the-city
2229-maximum-fruits-harvested-after-at-most-k-steps
2498-smallest-subarrays-with-maximum-bitwise-or
3437-maximum-total-damage-with-spell-casting
3454-separate-squares-ii
3619-adjacent-increasing-subarrays-detection-ii
3622-maximum-frequency-of-an-element-after-performing-operations-i
3790-fruits-into-baskets-ii

Brainteaser

2503-longest-subarray-with-maximum-bitwise-and

Breadth-First Search

0329-longest-increasing-path-in-a-matrix
0407-trapping-rain-water-ii
0514-freedom-trail
0695-max-area-of-island
0770-couples-holding-hands
0794-swim-in-rising-water
1161-maximum-level-sum-of-a-binary-tree
1747-lexicographically-smallest-string-after-applying-operations
3607-power-grid-maintenance
3863-power-grid-maintenance

Union Find

0695-max-area-of-island
0770-couples-holding-hands
0794-swim-in-rising-water
3607-power-grid-maintenance
3863-power-grid-maintenance

Combinatorics

0062-unique-paths
3851-find-sum-of-array-product-of-magical-sequences

Simulation

0498-diagonal-traverse
1642-water-bottles
2137-final-value-of-variable-after-performing-operations
2169-simple-bank-system
2211-count-collisions-on-a-road
2343-count-unguarded-cells-in-the-grid
2408-number-of-people-aware-of-a-secret
3336-water-bottles-ii
3510-minimum-pair-removal-to-sort-array-ii
3616-make-array-elements-equal-to-zero
3790-fruits-into-baskets-ii

Ordered Set

0729-my-calendar-i
3510-minimum-pair-removal-to-sort-array-ii
3607-power-grid-maintenance
3678-design-task-manager
3790-fruits-into-baskets-ii
3863-power-grid-maintenance

Probability and Statistics

0826-soup-servings

Recursion

0231-power-of-two
0326-power-of-three
0342-power-of-four

Counting

0347-top-k-frequent-elements
0900-reordered-power-of-2
2174-next-greater-numerically-balanced-number
3242-count-elements-with-maximum-frequency
3437-maximum-total-damage-with-spell-casting
3493-maximum-number-of-operations-to-move-ones-to-the-end
3872-find-most-frequent-vowel-and-consonant

Geometry

0149-max-points-on-a-line
0830-largest-triangle-area
3047-find-the-largest-area-of-square-inside-two-rectangles
3278-find-the-number-of-ways-to-place-people-i
3625-count-number-of-trapezoids-ii

Queue

2408-number-of-people-aware-of-a-secret
3578-count-partitions-with-max-min-difference-at-most-k

Number Theory

2307-replace-non-coprime-numbers-in-array

Design

0729-my-calendar-i
0901-online-stock-span
2169-simple-bank-system
3678-design-task-manager
3797-design-spreadsheet

Bitmask

3233-maximize-the-number-of-partitions-after-operations
3851-find-sum-of-array-product-of-magical-sequences

Graph

0329-longest-increasing-path-in-a-matrix
0770-couples-holding-hands
3607-power-grid-maintenance
3863-power-grid-maintenance

Topological Sort

0329-longest-increasing-path-in-a-matrix

Divide and Conquer

0347-top-k-frequent-elements

Bucket Sort

0347-top-k-frequent-elements

Quickselect

0347-top-k-frequent-elements

Monotonic Queue

3578-count-partitions-with-max-min-difference-at-most-k

Binary Tree

1161-maximum-level-sum-of-a-binary-tree
1339-maximum-product-of-splitted-binary-tree

Data Stream

0901-online-stock-span

Line Sweep

3454-separate-squares-ii

Doubly-Linked List

3510-minimum-pair-removal-to-sort-array-ii

Graph Theory

3650-minimum-cost-path-with-edge-reversals

Shortest Path

3650-minimum-cost-path-with-edge-reversals

About

DSA in C++ after 1st september 25

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages