Skip to content

apwic/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leetcode

Collection of LeetCode questions to ace the coding interview! - Created using LeetHub

Design

0295-find-median-from-data-stream
0346-moving-average-from-data-stream
0937-online-stock-span
0969-number-of-recent-calls

Queue

0239-sliding-window-maximum
0346-moving-average-from-data-stream
0649-dota2-senate
0969-number-of-recent-calls
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit

Data Stream

0295-find-median-from-data-stream
0346-moving-average-from-data-stream
0937-online-stock-span
0969-number-of-recent-calls

Array

0200-number-of-islands
0239-sliding-window-maximum
0346-moving-average-from-data-stream
0399-evaluate-division
0496-next-greater-element-i
0542-01-matrix
0695-max-area-of-island
0739-daily-temperatures
0753-open-the-lock
0945-snakes-and-ladders
1127-last-stone-weight
1171-shortest-path-in-binary-matrix
1414-shortest-path-in-a-grid-with-obstacles-elimination
1428-jump-game-iii
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
1570-final-prices-with-a-special-discount-in-a-shop
1792-find-the-most-competitive-subsequence
2038-nearest-exit-from-entrance-in-maze
2206-detonate-the-maximum-bombs
2310-minimum-operations-to-halve-array-sum
2445-reachable-nodes-with-restrictions

Stack

0094-binary-tree-inorder-traversal
0496-next-greater-element-i
0739-daily-temperatures
0937-online-stock-span
1570-final-prices-with-a-special-discount-in-a-shop
1792-find-the-most-competitive-subsequence

Monotonic Stack

0496-next-greater-element-i
0739-daily-temperatures
0937-online-stock-span
1570-final-prices-with-a-special-discount-in-a-shop
1792-find-the-most-competitive-subsequence

Sliding Window

0239-sliding-window-maximum
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit

Heap (Priority Queue)

0239-sliding-window-maximum
0295-find-median-from-data-stream
1127-last-stone-weight
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
2310-minimum-operations-to-halve-array-sum

Monotonic Queue

0239-sliding-window-maximum
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit

Ordered Set

1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit

Hash Table

0127-word-ladder
0433-minimum-genetic-mutation
0496-next-greater-element-i
0753-open-the-lock
0893-all-nodes-distance-k-in-binary-tree
2445-reachable-nodes-with-restrictions

String

0127-word-ladder
0399-evaluate-division
0433-minimum-genetic-mutation
0649-dota2-senate
0753-open-the-lock

Greedy

0649-dota2-senate
1792-find-the-most-competitive-subsequence
2310-minimum-operations-to-halve-array-sum

Tree

0094-binary-tree-inorder-traversal
0098-validate-binary-search-tree
0100-same-tree
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0111-minimum-depth-of-binary-tree
0199-binary-tree-right-side-view
0236-lowest-common-ancestor-of-a-binary-tree
0270-closest-binary-search-tree-value
0515-find-largest-value-in-each-tree-row
0530-minimum-absolute-difference-in-bst
0543-diameter-of-binary-tree
0784-insert-into-a-binary-search-tree
0893-all-nodes-distance-k-in-binary-tree
0975-range-sum-of-bst
1092-maximum-difference-between-node-and-ancestor
1254-deepest-leaves-sum
1544-count-good-nodes-in-binary-tree
2445-reachable-nodes-with-restrictions

Depth-First Search

0094-binary-tree-inorder-traversal
0098-validate-binary-search-tree
0100-same-tree
0104-maximum-depth-of-binary-tree
0111-minimum-depth-of-binary-tree
0199-binary-tree-right-side-view
0200-number-of-islands
0236-lowest-common-ancestor-of-a-binary-tree
0270-closest-binary-search-tree-value
0323-number-of-connected-components-in-an-undirected-graph
0399-evaluate-division
0515-find-largest-value-in-each-tree-row
0530-minimum-absolute-difference-in-bst
0543-diameter-of-binary-tree
0547-number-of-provinces
0695-max-area-of-island
0871-keys-and-rooms
0893-all-nodes-distance-k-in-binary-tree
0975-range-sum-of-bst
1092-maximum-difference-between-node-and-ancestor
1254-deepest-leaves-sum
1428-jump-game-iii
1544-count-good-nodes-in-binary-tree
1576-reorder-routes-to-make-all-paths-lead-to-the-city-zero
2121-find-if-path-exists-in-graph
2206-detonate-the-maximum-bombs
2445-reachable-nodes-with-restrictions

Breadth-First Search

0100-same-tree
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0111-minimum-depth-of-binary-tree
0127-word-ladder
0199-binary-tree-right-side-view
0200-number-of-islands
0323-number-of-connected-components-in-an-undirected-graph
0399-evaluate-division
0433-minimum-genetic-mutation
0515-find-largest-value-in-each-tree-row
0530-minimum-absolute-difference-in-bst
0542-01-matrix
0547-number-of-provinces
0695-max-area-of-island
0753-open-the-lock
0871-keys-and-rooms
0893-all-nodes-distance-k-in-binary-tree
0945-snakes-and-ladders
1171-shortest-path-in-binary-matrix
1229-shortest-path-with-alternating-colors
1254-deepest-leaves-sum
1414-shortest-path-in-a-grid-with-obstacles-elimination
1428-jump-game-iii
1544-count-good-nodes-in-binary-tree
1576-reorder-routes-to-make-all-paths-lead-to-the-city-zero
2038-nearest-exit-from-entrance-in-maze
2121-find-if-path-exists-in-graph
2206-detonate-the-maximum-bombs
2445-reachable-nodes-with-restrictions

Binary Tree

0094-binary-tree-inorder-traversal
0098-validate-binary-search-tree
0100-same-tree
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0111-minimum-depth-of-binary-tree
0199-binary-tree-right-side-view
0236-lowest-common-ancestor-of-a-binary-tree
0270-closest-binary-search-tree-value
0515-find-largest-value-in-each-tree-row
0530-minimum-absolute-difference-in-bst
0543-diameter-of-binary-tree
0784-insert-into-a-binary-search-tree
0893-all-nodes-distance-k-in-binary-tree
0975-range-sum-of-bst
1092-maximum-difference-between-node-and-ancestor
1254-deepest-leaves-sum
1544-count-good-nodes-in-binary-tree

Binary Search Tree

0098-validate-binary-search-tree
0270-closest-binary-search-tree-value
0530-minimum-absolute-difference-in-bst
0784-insert-into-a-binary-search-tree
0975-range-sum-of-bst

Union Find

0200-number-of-islands
0323-number-of-connected-components-in-an-undirected-graph
0399-evaluate-division
0547-number-of-provinces
0695-max-area-of-island
2121-find-if-path-exists-in-graph
2445-reachable-nodes-with-restrictions

Graph

0323-number-of-connected-components-in-an-undirected-graph
0399-evaluate-division
0547-number-of-provinces
0871-keys-and-rooms
1229-shortest-path-with-alternating-colors
1576-reorder-routes-to-make-all-paths-lead-to-the-city-zero
1661-minimum-number-of-vertices-to-reach-all-nodes
2121-find-if-path-exists-in-graph
2206-detonate-the-maximum-bombs
2445-reachable-nodes-with-restrictions

Matrix

0200-number-of-islands
0542-01-matrix
0695-max-area-of-island
0945-snakes-and-ladders
1171-shortest-path-in-binary-matrix
1414-shortest-path-in-a-grid-with-obstacles-elimination
2038-nearest-exit-from-entrance-in-maze

Dynamic Programming

0542-01-matrix

Shortest Path

0399-evaluate-division

Math

2206-detonate-the-maximum-bombs

Geometry

2206-detonate-the-maximum-bombs

Two Pointers

0295-find-median-from-data-stream

Sorting

0295-find-median-from-data-stream

LeetCode Topics

Array

0035-search-insert-position
0039-combination-sum
0040-combination-sum-ii
0046-permutations
0047-permutations-ii
0051-n-queens
0053-maximum-subarray
0054-spiral-matrix
0063-unique-paths-ii
0064-minimum-path-sum
0066-plus-one
0074-search-a-2d-matrix
0078-subsets
0079-word-search
0090-subsets-ii
0120-triangle
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0128-longest-consecutive-sequence
0136-single-number
0137-single-number-ii
0198-house-robber
0213-house-robber-ii
0215-kth-largest-element-in-an-array
0216-combination-sum-iii
0238-product-of-array-except-self
0300-longest-increasing-subsequence
0309-best-time-to-buy-and-sell-stock-with-cooldown
0322-coin-change
0347-top-k-frequent-elements
0410-split-array-largest-sum
0491-non-decreasing-subsequences
0494-target-sum
0502-ipo
0518-coin-change-ii
0539-minimum-time-difference
0624-maximum-distance-in-arrays
0632-smallest-range-covering-elements-from-k-lists
0658-find-k-closest-elements
0689-maximum-sum-of-3-non-overlapping-subarrays
0714-best-time-to-buy-and-sell-stock-with-transaction-fee
0747-min-cost-climbing-stairs
0780-max-chunks-to-make-sorted
0787-sliding-puzzle
0792-binary-search
0875-longest-mountain-in-array
0892-shortest-subarray-with-sum-at-least-k
0906-walking-robot-simulation
0907-koko-eating-bananas
0909-stone-game
1002-maximum-width-ramp
1014-k-closest-points-to-origin
1063-best-sightseeing-pair
1126-minimum-cost-to-connect-sticks
1141-how-many-apples-can-you-put-into-the-basket
1147-flip-columns-for-maximum-number-of-equal-rows
1184-car-pooling
1192-divide-chocolate
1256-rank-transform-of-an-array
1293-three-consecutive-odds
1325-path-with-maximum-probability
1350-remove-sub-folders-from-the-filesystem
1397-search-suggestions-system
1402-count-square-submatrices-with-all-ones
1408-find-the-smallest-divisor-given-a-threshold
1435-xor-queries-of-a-subarray
1463-the-k-weakest-rows-in-a-matrix
1464-reduce-array-size-to-the-half
1468-check-if-n-and-its-double-exist
1497-design-a-stack-with-increment-operation
1556-make-two-arrays-equal-by-reversing-subarrays
1570-final-prices-with-a-special-discount-in-a-shop
1604-least-number-of-unique-integers-after-k-removals
1620-check-if-array-pairs-are-divisible-by-k
1679-shortest-subarray-to-be-removed-to-make-array-sorted
1694-make-sum-divisible-by-p
1744-number-of-ways-to-form-a-target-string-given-a-dictionary
1753-path-with-minimum-effort
1755-defuse-the-bomb
1766-minimum-number-of-removals-to-make-mountain-array
1786-count-the-number-of-consistent-strings
1829-maximum-units-on-a-truck
1839-decode-xored-array
1886-minimum-limit-of-balls-in-a-bag
1917-maximum-average-pass-ratio
1923-sentence-similarity-iii
1940-maximum-xor-for-each-query
1972-rotating-the-box
1984-maximum-distance-between-a-pair-of-values
2000-minimum-speed-to-arrive-on-time
2054-the-number-of-the-smallest-unoccupied-chair
2067-maximum-number-of-points-with-cost
2089-maximum-matrix-sum
2094-remove-stones-to-minimize-the-total
2155-find-missing-observations
2163-kth-distinct-string-in-an-array
2164-two-best-non-overlapping-events
2170-count-number-of-maximum-bitwise-or-subsets
2175-count-nodes-with-the-highest-score
2179-most-beautiful-item-for-each-query
2188-minimized-maximum-of-products-distributed-to-any-store
2232-adding-spaces-to-a-string
2245-destroying-asteroids
2262-solving-questions-with-brainpower
2283-sort-even-and-odd-indices-independently
2343-count-unguarded-cells-in-the-grid
2356-largest-combination-with-bitwise-and-greater-than-zero
2375-minimum-obstacle-removal-to-reach-corner
2387-partition-array-such-that-maximum-difference-is-k
2392-successful-pairs-of-spells-and-potions
2469-longest-subsequence-with-limited-sum
2488-divide-intervals-into-minimum-number-of-groups
2502-sort-the-people
2503-longest-subarray-with-maximum-bitwise-and
2545-height-of-binary-tree-after-subtree-removal-queries
2552-maximum-sum-of-distinct-subarrays-with-length-k
2554-minimum-total-distance-traveled
2581-divide-players-into-teams-of-equal-skill
2586-longest-square-streak-in-an-array
2616-maximal-score-after-applying-k-operations
2640-maximum-number-of-integers-to-choose-from-a-range-i
2692-take-gifts-from-the-richest-pile
2695-find-score-of-an-array-after-marking-all-elements
2699-count-the-number-of-fair-pairs
2711-minimum-time-to-visit-a-cell-in-a-grid
2716-prime-subtraction-operation
2727-number-of-senior-citizens
2794-maximum-number-of-moves-in-a-grid
2868-continuous-subarrays
2891-maximum-beauty-of-an-array-after-applying-operation
3113-beautiful-towers-ii
3114-beautiful-towers-i
3143-longest-unequal-adjacent-groups-subsequence-i
3181-find-building-where-alice-and-bob-can-meet
3188-find-champion-i
3291-find-if-array-can-be-sorted
3329-find-the-length-of-the-longest-common-prefix
3380-shortest-subarray-with-or-at-least-k-ii
3427-special-array-ii
3501-delete-nodes-from-linked-list-present-in-array
3517-shortest-distance-after-road-addition-queries-i
3522-find-the-power-of-k-size-subarrays-i
3555-final-array-state-after-k-multiplication-operations-i

Greedy

0122-best-time-to-buy-and-sell-stock-ii
0410-split-array-largest-sum
0502-ipo
0624-maximum-distance-in-arrays
0632-smallest-range-covering-elements-from-k-lists
0670-maximum-swap
0714-best-time-to-buy-and-sell-stock-with-transaction-fee
0780-max-chunks-to-make-sorted
0957-minimum-add-to-make-parentheses-valid
1126-minimum-cost-to-connect-sticks
1141-how-many-apples-can-you-put-into-the-basket
1304-longest-happy-string
1448-maximum-69-number
1464-reduce-array-size-to-the-half
1604-least-number-of-unique-integers-after-k-removals
1766-minimum-number-of-removals-to-make-mountain-array
1829-maximum-units-on-a-truck
1917-maximum-average-pass-ratio
2089-maximum-matrix-sum
2094-remove-stones-to-minimize-the-total
2095-minimum-number-of-swaps-to-make-the-string-balanced
2245-destroying-asteroids
2300-construct-string-with-repeat-limit
2387-partition-array-such-that-maximum-difference-is-k
2469-longest-subsequence-with-limited-sum
2488-divide-intervals-into-minimum-number-of-groups
2616-maximal-score-after-applying-k-operations
2640-maximum-number-of-integers-to-choose-from-a-range-i
2716-prime-subtraction-operation
3143-longest-unequal-adjacent-groups-subsequence-i
3195-separate-black-and-white-balls

Heap (Priority Queue)

0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
0502-ipo
0632-smallest-range-covering-elements-from-k-lists
0658-find-k-closest-elements
0692-top-k-frequent-words
0789-kth-largest-element-in-a-stream
0892-shortest-subarray-with-sum-at-least-k
1014-k-closest-points-to-origin
1126-minimum-cost-to-connect-sticks
1184-car-pooling
1304-longest-happy-string
1325-path-with-maximum-probability
1397-search-suggestions-system
1463-the-k-weakest-rows-in-a-matrix
1464-reduce-array-size-to-the-half
1753-path-with-minimum-effort
1917-maximum-average-pass-ratio
2054-the-number-of-the-smallest-unoccupied-chair
2094-remove-stones-to-minimize-the-total
2164-two-best-non-overlapping-events
2300-construct-string-with-repeat-limit
2375-minimum-obstacle-removal-to-reach-corner
2488-divide-intervals-into-minimum-number-of-groups
2616-maximal-score-after-applying-k-operations
2692-take-gifts-from-the-richest-pile
2695-find-score-of-an-array-after-marking-all-elements
2711-minimum-time-to-visit-a-cell-in-a-grid
2868-continuous-subarrays
3181-find-building-where-alice-and-bob-can-meet
3555-final-array-state-after-k-multiplication-operations-i

Hash Table

0017-letter-combinations-of-a-phone-number
0128-longest-consecutive-sequence
0347-top-k-frequent-elements
0438-find-all-anagrams-in-a-string
0491-non-decreasing-subsequences
0567-permutation-in-string
0632-smallest-range-covering-elements-from-k-lists
0692-top-k-frequent-words
0906-walking-robot-simulation
0920-uncommon-words-from-two-sentences
1147-flip-columns-for-maximum-number-of-equal-rows
1256-rank-transform-of-an-array
1464-reduce-array-size-to-the-half
1468-check-if-n-and-its-double-exist
1473-find-the-longest-substring-containing-vowels-in-even-counts
1556-make-two-arrays-equal-by-reversing-subarrays
1604-least-number-of-unique-integers-after-k-removals
1620-check-if-array-pairs-are-divisible-by-k
1694-make-sum-divisible-by-p
1715-split-a-string-into-the-max-number-of-unique-substrings
1786-count-the-number-of-consistent-strings
2054-the-number-of-the-smallest-unoccupied-chair
2163-kth-distinct-string-in-an-array
2300-construct-string-with-repeat-limit
2356-largest-combination-with-bitwise-and-greater-than-zero
2502-sort-the-people
2552-maximum-sum-of-distinct-subarrays-with-length-k
2581-divide-players-into-teams-of-equal-skill
2586-longest-square-streak-in-an-array
2599-take-k-of-each-character-from-left-and-right
2640-maximum-number-of-integers-to-choose-from-a-range-i
2677-cousins-in-binary-tree-ii
2695-find-score-of-an-array-after-marking-all-elements
3267-find-longest-special-substring-that-occurs-thrice-i
3329-find-the-length-of-the-longest-common-prefix
3501-delete-nodes-from-linked-list-present-in-array

Divide and Conquer

0053-maximum-subarray
0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
1014-k-closest-points-to-origin

Sorting

0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
0502-ipo
0539-minimum-time-difference
0632-smallest-range-covering-elements-from-k-lists
0658-find-k-closest-elements
0692-top-k-frequent-words
0780-max-chunks-to-make-sorted
1014-k-closest-points-to-origin
1141-how-many-apples-can-you-put-into-the-basket
1184-car-pooling
1256-rank-transform-of-an-array
1397-search-suggestions-system
1463-the-k-weakest-rows-in-a-matrix
1464-reduce-array-size-to-the-half
1468-check-if-n-and-its-double-exist
1556-make-two-arrays-equal-by-reversing-subarrays
1604-least-number-of-unique-integers-after-k-removals
1829-maximum-units-on-a-truck
2164-two-best-non-overlapping-events
2179-most-beautiful-item-for-each-query
2245-destroying-asteroids
2283-sort-even-and-odd-indices-independently
2387-partition-array-such-that-maximum-difference-is-k
2392-successful-pairs-of-spells-and-potions
2469-longest-subsequence-with-limited-sum
2488-divide-intervals-into-minimum-number-of-groups
2502-sort-the-people
2554-minimum-total-distance-traveled
2581-divide-players-into-teams-of-equal-skill
2586-longest-square-streak-in-an-array
2640-maximum-number-of-integers-to-choose-from-a-range-i
2646-kth-largest-sum-in-a-binary-tree
2695-find-score-of-an-array-after-marking-all-elements
2699-count-the-number-of-fair-pairs
2891-maximum-beauty-of-an-array-after-applying-operation
3291-find-if-array-can-be-sorted

Bucket Sort

0347-top-k-frequent-elements
0692-top-k-frequent-words

Counting

0347-top-k-frequent-elements
0692-top-k-frequent-words
0920-uncommon-words-from-two-sentences
1604-least-number-of-unique-integers-after-k-removals
1620-check-if-array-pairs-are-divisible-by-k
1786-count-the-number-of-consistent-strings
2163-kth-distinct-string-in-an-array
2300-construct-string-with-repeat-limit
2356-largest-combination-with-bitwise-and-greater-than-zero
3267-find-longest-special-substring-that-occurs-thrice-i

Quickselect

0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
1014-k-closest-points-to-origin

Two Pointers

0125-valid-palindrome
0443-string-compression
0567-permutation-in-string
0658-find-k-closest-elements
0875-longest-mountain-in-array
1468-check-if-n-and-its-double-exist
1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
1679-shortest-subarray-to-be-removed-to-make-array-sorted
1923-sentence-similarity-iii
1972-rotating-the-box
1984-maximum-distance-between-a-pair-of-values
2095-minimum-number-of-swaps-to-make-the-string-balanced
2232-adding-spaces-to-a-string
2392-successful-pairs-of-spells-and-potions
2414-move-pieces-to-obtain-a-string
2488-divide-intervals-into-minimum-number-of-groups
2581-divide-players-into-teams-of-equal-skill
2699-count-the-number-of-fair-pairs
3018-make-string-a-subsequence-using-cyclic-increments
3195-separate-black-and-white-balls

Binary Search

0035-search-insert-position
0069-sqrtx
0074-search-a-2d-matrix
0300-longest-increasing-subsequence
0374-guess-number-higher-or-lower
0410-split-array-largest-sum
0658-find-k-closest-elements
0792-binary-search
0892-shortest-subarray-with-sum-at-least-k
0907-koko-eating-bananas
1192-divide-chocolate
1397-search-suggestions-system
1408-find-the-smallest-divisor-given-a-threshold
1463-the-k-weakest-rows-in-a-matrix
1468-check-if-n-and-its-double-exist
1679-shortest-subarray-to-be-removed-to-make-array-sorted
1753-path-with-minimum-effort
1766-minimum-number-of-removals-to-make-mountain-array
1886-minimum-limit-of-balls-in-a-bag
1984-maximum-distance-between-a-pair-of-values
2000-minimum-speed-to-arrive-on-time
2164-two-best-non-overlapping-events
2179-most-beautiful-item-for-each-query
2188-minimized-maximum-of-products-distributed-to-any-store
2392-successful-pairs-of-spells-and-potions
2469-longest-subsequence-with-limited-sum
2586-longest-square-streak-in-an-array
2640-maximum-number-of-integers-to-choose-from-a-range-i
2699-count-the-number-of-fair-pairs
2716-prime-subtraction-operation
2891-maximum-beauty-of-an-array-after-applying-operation
3181-find-building-where-alice-and-bob-can-meet
3267-find-longest-special-substring-that-occurs-thrice-i
3427-special-array-ii

Sliding Window

0438-find-all-anagrams-in-a-string
0567-permutation-in-string
0632-smallest-range-covering-elements-from-k-lists
0658-find-k-closest-elements
0892-shortest-subarray-with-sum-at-least-k
1755-defuse-the-bomb
2552-maximum-sum-of-distinct-subarrays-with-length-k
2599-take-k-of-each-character-from-left-and-right
2868-continuous-subarrays
2891-maximum-beauty-of-an-array-after-applying-operation
3267-find-longest-special-substring-that-occurs-thrice-i
3380-shortest-subarray-with-or-at-least-k-ii
3522-find-the-power-of-k-size-subarrays-i

Math

0062-unique-paths
0066-plus-one
0069-sqrtx
0070-climbing-stairs
0241-different-ways-to-add-parentheses
0357-count-numbers-with-unique-digits
0539-minimum-time-difference
0650-2-keys-keyboard
0670-maximum-swap
0909-stone-game
1013-fibonacci-number
1014-k-closest-points-to-origin
1236-n-th-tribonacci-number
1448-maximum-69-number
1642-water-bottles
2155-find-missing-observations
2645-pass-the-pillow
2716-prime-subtraction-operation
2903-insert-greatest-common-divisors-in-linked-list
3450-find-the-child-who-has-the-ball-after-k-seconds
3555-final-array-state-after-k-multiplication-operations-i

Geometry

1014-k-closest-points-to-origin

Tree

0129-sum-root-to-leaf-numbers
0145-binary-tree-postorder-traversal
0226-invert-binary-tree
0515-find-largest-value-in-each-tree-row
0776-n-ary-tree-postorder-traversal
0789-kth-largest-element-in-a-stream
0988-flip-equivalent-binary-trees
1484-linked-list-in-binary-tree
2175-count-nodes-with-the-highest-score
2493-reverse-odd-levels-of-binary-tree
2545-height-of-binary-tree-after-subtree-removal-queries
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2646-kth-largest-sum-in-a-binary-tree
2677-cousins-in-binary-tree-ii
3058-maximum-number-of-k-divisible-components
3439-find-minimum-diameter-after-merging-two-trees

Design

0789-kth-largest-element-in-a-stream
1497-design-a-stack-with-increment-operation

Binary Search Tree

0789-kth-largest-element-in-a-stream

Binary Tree

0129-sum-root-to-leaf-numbers
0145-binary-tree-postorder-traversal
0226-invert-binary-tree
0515-find-largest-value-in-each-tree-row
0789-kth-largest-element-in-a-stream
0988-flip-equivalent-binary-trees
1484-linked-list-in-binary-tree
2175-count-nodes-with-the-highest-score
2493-reverse-odd-levels-of-binary-tree
2545-height-of-binary-tree-after-subtree-removal-queries
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2646-kth-largest-sum-in-a-binary-tree
2677-cousins-in-binary-tree-ii

Data Stream

0789-kth-largest-element-in-a-stream

Matrix

0054-spiral-matrix
0063-unique-paths-ii
0064-minimum-path-sum
0074-search-a-2d-matrix
0079-word-search
0787-sliding-puzzle
1147-flip-columns-for-maximum-number-of-equal-rows
1402-count-square-submatrices-with-all-ones
1463-the-k-weakest-rows-in-a-matrix
1753-path-with-minimum-effort
1972-rotating-the-box
2089-maximum-matrix-sum
2343-count-unguarded-cells-in-the-grid
2375-minimum-obstacle-removal-to-reach-corner
2711-minimum-time-to-visit-a-cell-in-a-grid
2794-maximum-number-of-moves-in-a-grid
3188-find-champion-i

Prefix Sum

0238-product-of-array-except-self
0410-split-array-largest-sum
0892-shortest-subarray-with-sum-at-least-k
1184-car-pooling
1435-xor-queries-of-a-subarray
1473-find-the-longest-substring-containing-vowels-in-even-counts
1694-make-sum-divisible-by-p
1940-maximum-xor-for-each-query
2469-longest-subsequence-with-limited-sum
2488-divide-intervals-into-minimum-number-of-groups
3427-special-array-ii

Depth-First Search

0129-sum-root-to-leaf-numbers
0145-binary-tree-postorder-traversal
0226-invert-binary-tree
0386-lexicographical-numbers
0515-find-largest-value-in-each-tree-row
0776-n-ary-tree-postorder-traversal
0813-all-paths-from-source-to-target
0988-flip-equivalent-binary-trees
1350-remove-sub-folders-from-the-filesystem
1484-linked-list-in-binary-tree
1753-path-with-minimum-effort
2175-count-nodes-with-the-highest-score
2201-valid-arrangement-of-pairs
2493-reverse-odd-levels-of-binary-tree
2545-height-of-binary-tree-after-subtree-removal-queries
2677-cousins-in-binary-tree-ii
3058-maximum-number-of-k-divisible-components
3439-find-minimum-diameter-after-merging-two-trees

Breadth-First Search

0226-invert-binary-tree
0322-coin-change
0515-find-largest-value-in-each-tree-row
0787-sliding-puzzle
0813-all-paths-from-source-to-target
1007-numbers-with-same-consecutive-differences
1484-linked-list-in-binary-tree
1753-path-with-minimum-effort
2375-minimum-obstacle-removal-to-reach-corner
2493-reverse-odd-levels-of-binary-tree
2545-height-of-binary-tree-after-subtree-removal-queries
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2646-kth-largest-sum-in-a-binary-tree
2677-cousins-in-binary-tree-ii
2711-minimum-time-to-visit-a-cell-in-a-grid
3439-find-minimum-diameter-after-merging-two-trees
3517-shortest-distance-after-road-addition-queries-i

Union Find

0128-longest-consecutive-sequence
1753-path-with-minimum-effort

Dynamic Programming

0022-generate-parentheses
0053-maximum-subarray
0062-unique-paths
0063-unique-paths-ii
0064-minimum-path-sum
0070-climbing-stairs
0120-triangle
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0198-house-robber
0213-house-robber-ii
0241-different-ways-to-add-parentheses
0300-longest-increasing-subsequence
0309-best-time-to-buy-and-sell-stock-with-cooldown
0322-coin-change
0338-counting-bits
0357-count-numbers-with-unique-digits
0410-split-array-largest-sum
0494-target-sum
0518-coin-change-ii
0650-2-keys-keyboard
0689-maximum-sum-of-3-non-overlapping-subarrays
0714-best-time-to-buy-and-sell-stock-with-transaction-fee
0747-min-cost-climbing-stairs
0875-longest-mountain-in-array
0909-stone-game
1013-fibonacci-number
1063-best-sightseeing-pair
1236-n-th-tribonacci-number
1250-longest-common-subsequence
1402-count-square-submatrices-with-all-ones
1744-number-of-ways-to-form-a-target-string-given-a-dictionary
1764-maximum-repeating-substring
1766-minimum-number-of-removals-to-make-mountain-array
2067-maximum-number-of-points-with-cost
2164-two-best-non-overlapping-events
2262-solving-questions-with-brainpower
2554-minimum-total-distance-traveled
2586-longest-square-streak-in-an-array
2794-maximum-number-of-moves-in-a-grid
3143-longest-unequal-adjacent-groups-subsequence-i

Interactive

0374-guess-number-higher-or-lower

Backtracking

0017-letter-combinations-of-a-phone-number
0022-generate-parentheses
0039-combination-sum
0040-combination-sum-ii
0046-permutations
0047-permutations-ii
0051-n-queens
0052-n-queens-ii
0077-combinations
0078-subsets
0079-word-search
0090-subsets-ii
0216-combination-sum-iii
0357-count-numbers-with-unique-digits
0491-non-decreasing-subsequences
0494-target-sum
0813-all-paths-from-source-to-target
1007-numbers-with-same-consecutive-differences
1715-split-a-string-into-the-max-number-of-unique-substrings
2170-count-number-of-maximum-bitwise-or-subsets

Bit Manipulation

0078-subsets
0090-subsets-ii
0136-single-number
0137-single-number-ii
0338-counting-bits
0476-number-complement
0491-non-decreasing-subsequences
1054-complement-of-base-10-integer
1435-xor-queries-of-a-subarray
1473-find-the-longest-substring-containing-vowels-in-even-counts
1786-count-the-number-of-consistent-strings
1839-decode-xored-array
1940-maximum-xor-for-each-query
2170-count-number-of-maximum-bitwise-or-subsets
2323-minimum-bit-flips-to-convert-number
2356-largest-combination-with-bitwise-and-greater-than-zero
2503-longest-subarray-with-maximum-bitwise-and
3291-find-if-array-can-be-sorted
3380-shortest-subarray-with-or-at-least-k-ii
3394-minimum-array-end

Graph

0813-all-paths-from-source-to-target
1325-path-with-maximum-probability
1916-find-center-of-star-graph
2201-valid-arrangement-of-pairs
2375-minimum-obstacle-removal-to-reach-corner
2711-minimum-time-to-visit-a-cell-in-a-grid
3189-find-champion-ii
3439-find-minimum-diameter-after-merging-two-trees
3517-shortest-distance-after-road-addition-queries-i

String

0017-letter-combinations-of-a-phone-number
0020-valid-parentheses
0022-generate-parentheses
0079-word-search
0125-valid-palindrome
0241-different-ways-to-add-parentheses
0438-find-all-anagrams-in-a-string
0443-string-compression
0539-minimum-time-difference
0567-permutation-in-string
0692-top-k-frequent-words
0812-rotate-string
0920-uncommon-words-from-two-sentences
0957-minimum-add-to-make-parentheses-valid
1197-parsing-a-boolean-expression
1250-longest-common-subsequence
1302-delete-characters-to-make-fancy-string
1304-longest-happy-string
1350-remove-sub-folders-from-the-filesystem
1397-search-suggestions-system
1473-find-the-longest-substring-containing-vowels-in-even-counts
1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
1667-find-kth-bit-in-nth-binary-string
1715-split-a-string-into-the-max-number-of-unique-substrings
1744-number-of-ways-to-form-a-target-string-given-a-dictionary
1764-maximum-repeating-substring
1786-count-the-number-of-consistent-strings
1923-sentence-similarity-iii
2076-sum-of-digits-of-string-after-convert
2095-minimum-number-of-swaps-to-make-the-string-balanced
2163-kth-distinct-string-in-an-array
2232-adding-spaces-to-a-string
2300-construct-string-with-repeat-limit
2414-move-pieces-to-obtain-a-string
2502-sort-the-people
2580-circular-sentence
2599-take-k-of-each-character-from-left-and-right
2727-number-of-senior-citizens
2800-minimum-string-length-after-removing-substrings
3018-make-string-a-subsequence-using-cyclic-increments
3143-longest-unequal-adjacent-groups-subsequence-i
3174-minimum-number-of-changes-to-make-binary-string-beautiful
3195-separate-black-and-white-balls
3267-find-longest-special-substring-that-occurs-thrice-i
3329-find-the-length-of-the-longest-common-prefix
3451-string-compression-iii

Memoization

0070-climbing-stairs
0241-different-ways-to-add-parentheses
1013-fibonacci-number
1236-n-th-tribonacci-number

Recursion

0241-different-ways-to-add-parentheses
1013-fibonacci-number
1197-parsing-a-boolean-expression
1667-find-kth-bit-in-nth-binary-string

String Matching

0812-rotate-string
1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
1764-maximum-repeating-substring

Simulation

0054-spiral-matrix
0906-walking-robot-simulation
1184-car-pooling
1642-water-bottles
1667-find-kth-bit-in-nth-binary-string
2076-sum-of-digits-of-string-after-convert
2155-find-missing-observations
2232-adding-spaces-to-a-string
2343-count-unguarded-cells-in-the-grid
2645-pass-the-pillow
2692-take-gifts-from-the-richest-pile
2695-find-score-of-an-array-after-marking-all-elements
2800-minimum-string-length-after-removing-substrings
3450-find-the-child-who-has-the-ball-after-k-seconds
3555-final-array-state-after-k-multiplication-operations-i

Combinatorics

0062-unique-paths

Game Theory

0909-stone-game

Stack

0020-valid-parentheses
0145-binary-tree-postorder-traversal
0776-n-ary-tree-postorder-traversal
0780-max-chunks-to-make-sorted
0957-minimum-add-to-make-parentheses-valid
1002-maximum-width-ramp
1197-parsing-a-boolean-expression
1497-design-a-stack-with-increment-operation
1570-final-prices-with-a-special-discount-in-a-shop
1679-shortest-subarray-to-be-removed-to-make-array-sorted
2095-minimum-number-of-swaps-to-make-the-string-balanced
2800-minimum-string-length-after-removing-substrings
3113-beautiful-towers-ii
3114-beautiful-towers-i
3181-find-building-where-alice-and-bob-can-meet

Shortest Path

1325-path-with-maximum-probability
2375-minimum-obstacle-removal-to-reach-corner
2711-minimum-time-to-visit-a-cell-in-a-grid

Linked List

0725-split-linked-list-in-parts
1484-linked-list-in-binary-tree
2903-insert-greatest-common-divisors-in-linked-list
3501-delete-nodes-from-linked-list-present-in-array

Number Theory

2716-prime-subtraction-operation
2903-insert-greatest-common-divisors-in-linked-list

Brainteaser

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

Trie

0386-lexicographical-numbers
0692-top-k-frequent-words
1350-remove-sub-folders-from-the-filesystem
1397-search-suggestions-system
3329-find-the-length-of-the-longest-common-prefix

Monotonic Stack

0780-max-chunks-to-make-sorted
1002-maximum-width-ramp
1570-final-prices-with-a-special-discount-in-a-shop
1679-shortest-subarray-to-be-removed-to-make-array-sorted
3113-beautiful-towers-ii
3114-beautiful-towers-i
3181-find-building-where-alice-and-bob-can-meet

Enumeration

0875-longest-mountain-in-array
2170-count-number-of-maximum-bitwise-or-subsets

Database

0175-combine-two-tables
0176-second-highest-salary
0177-nth-highest-salary
0181-employees-earning-more-than-their-managers
0182-duplicate-emails
0183-customers-who-never-order

Queue

0892-shortest-subarray-with-sum-at-least-k
2868-continuous-subarrays

Monotonic Queue

0892-shortest-subarray-with-sum-at-least-k
2868-continuous-subarrays

Eulerian Circuit

2201-valid-arrangement-of-pairs

Ordered Set

2868-continuous-subarrays

Binary Indexed Tree

3181-find-building-where-alice-and-bob-can-meet

Segment Tree

3181-find-building-where-alice-and-bob-can-meet

About

Collection of solution to LeetCode questions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published