Skip to content

so far dsa questions i have done or will do

Steller12/leetcode-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leetcode-practice

A collection of LeetCode questions to ace the coding interview! - Created using LeetHub v2

LeetCode Topics

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0013-roman-to-integer
0036-valid-sudoku
0049-group-anagrams
0073-set-matrix-zeroes
0128-longest-consecutive-sequence
0169-majority-element
0202-happy-number
0217-contains-duplicate
0229-majority-element-ii
0242-valid-anagram
0347-top-k-frequent-elements
0424-longest-repeating-character-replacement
0451-sort-characters-by-frequency
0594-longest-harmonious-subsequence
0816-design-hashset
0817-design-hashmap
0940-fruit-into-baskets
1227-number-of-equivalent-domino-pairs
1256-rank-transform-of-an-array
1319-unique-number-of-occurrences
1500-count-largest-group
1510-find-lucky-integer-in-an-array
1694-make-sum-divisible-by-p
1813-maximum-erasure-value
1915-check-if-one-string-swap-can-make-strings-equal
1986-largest-color-value-in-a-directed-graph
1995-finding-pairs-with-a-certain-sum
2169-simple-bank-system
2215-finding-3-digit-even-numbers
2237-longest-palindrome-by-concatenating-two-letter-words
2520-using-a-robot-to-print-the-lexicographically-smallest-string
2525-count-number-of-distinct-integers-after-reverse-operations
2689-rearranging-fruits
2847-find-maximum-number-of-string-pairs
3242-count-elements-with-maximum-frequency
3360-minimum-deletions-to-make-string-k-special
3445-lexicographically-minimum-string-after-removing-stars
3629-total-characters-in-string-after-transformations-i
3630-total-characters-in-string-after-transformations-ii
3753-maximum-difference-between-even-and-odd-frequency-i
3754-maximum-manhattan-distance-after-k-changes
3788-maximum-unique-subarray-sum-after-deletion

Math

0002-add-two-numbers
0007-reverse-integer
0009-palindrome-number
0013-roman-to-integer
0202-happy-number
0231-power-of-two
0342-power-of-four
0679-24-game
0826-soup-servings
0830-largest-triangle-area
0867-new-21-game
1013-fibonacci-number
1411-convert-binary-number-in-a-linked-list-to-integer
1421-find-numbers-with-even-number-of-digits
1448-maximum-69-number
1500-count-largest-group
1817-calculate-money-in-leetcode-bank
2032-largest-odd-number-in-string
2160-minimum-operations-to-make-a-uni-value-grid
2202-sum-of-k-mirror-numbers
2324-find-triangular-sum-of-an-array
2432-number-of-zero-filled-subarrays
2525-count-number-of-distinct-integers-after-reverse-operations
2608-count-the-digits-that-divide-a-number
2704-maximum-difference-by-remapping-a-digit
3172-divisible-and-non-divisible-sums-difference
3201-distribute-candies-among-children-ii
3278-find-the-number-of-ways-to-place-people-i
3321-type-of-triangle
3600-find-the-k-th-character-in-string-game-i
3629-total-characters-in-string-after-transformations-i
3630-total-characters-in-string-after-transformations-ii
3637-count-number-of-balanced-permutations
3676-smallest-number-with-all-set-bits
3682-count-the-number-of-arrays-with-k-matching-adjacent-elements
3754-maximum-manhattan-distance-after-k-changes

Two Pointers

0011-container-with-most-water
0015-3sum
0019-remove-nth-node-from-end-of-list
0026-remove-duplicates-from-sorted-array
0027-remove-element
0075-sort-colors
0125-valid-palindrome
0151-reverse-words-in-a-string
0165-compare-version-numbers
0202-happy-number
0344-reverse-string
0868-push-dominoes
2320-find-all-k-distant-indices-in-an-array
2392-successful-pairs-of-spells-and-potions
3683-find-the-lexicographically-largest-string-from-the-box-i

Array

0001-two-sum
0004-median-of-two-sorted-arrays
0011-container-with-most-water
0015-3sum
0026-remove-duplicates-from-sorted-array
0027-remove-element
0034-find-first-and-last-position-of-element-in-sorted-array
0036-valid-sudoku
0049-group-anagrams
0073-set-matrix-zeroes
0074-search-a-2d-matrix
0075-sort-colors
0081-search-in-rotated-sorted-array-ii
0118-pascals-triangle
0121-best-time-to-buy-and-sell-stock
0128-longest-consecutive-sequence
0135-candy
0153-find-minimum-in-rotated-sorted-array
0169-majority-element
0217-contains-duplicate
0229-majority-element-ii
0238-product-of-array-except-self
0240-search-a-2d-matrix-ii
0347-top-k-frequent-elements
0594-longest-harmonious-subsequence
0679-24-game
0713-subarray-product-less-than-k
0794-swim-in-rising-water
0816-design-hashset
0817-design-hashmap
0830-largest-triangle-area
0882-peak-index-in-a-mountain-array
0907-koko-eating-bananas
0940-fruit-into-baskets
0945-snakes-and-ladders
0948-sort-an-array
1002-maximum-width-ramp
1049-minimum-domino-rotations-for-equal-row
1227-number-of-equivalent-domino-pairs
1256-rank-transform-of-an-array
1293-three-consecutive-odds
1319-unique-number-of-occurrences
1402-count-square-submatrices-with-all-ones
1421-find-numbers-with-even-number-of-digits
1424-maximum-candies-you-can-get-from-boxes
1478-maximum-number-of-events-that-can-be-attended
1510-find-lucky-integer-in-an-array
1603-running-sum-of-1d-array
1694-make-sum-divisible-by-p
1813-maximum-erasure-value
1851-maximum-number-of-events-that-can-be-attended-ii
1878-check-if-array-is-sorted-and-rotated
1927-maximum-ascending-subarray-sum
1995-finding-pairs-with-a-certain-sum
2048-build-array-from-permutation
2058-concatenation-of-array
2144-maximum-difference-between-increasing-elements
2150-kth-smallest-product-of-two-sorted-arrays
2160-minimum-operations-to-make-a-uni-value-grid
2169-simple-bank-system
2170-count-number-of-maximum-bitwise-or-subsets
2180-maximum-number-of-tasks-you-can-assign
2215-finding-3-digit-even-numbers
2229-maximum-fruits-harvested-after-at-most-k-steps
2237-longest-palindrome-by-concatenating-two-letter-words
2316-count-hills-and-valleys-in-an-array
2320-find-all-k-distant-indices-in-an-array
2324-find-triangular-sum-of-an-array
2387-partition-array-such-that-maximum-difference-is-k
2392-successful-pairs-of-spells-and-potions
2394-count-subarrays-with-score-less-than-k
2432-number-of-zero-filled-subarrays
2525-count-number-of-distinct-integers-after-reverse-operations
2529-range-product-queries-of-powers
2689-rearranging-fruits
2720-minimize-the-maximum-difference-of-pairs
2847-find-maximum-number-of-string-pairs
2977-check-if-a-string-is-an-acronym-of-words
3142-longest-unequal-adjacent-groups-subsequence-ii
3143-longest-unequal-adjacent-groups-subsequence-i
3171-minimum-equal-sum-of-two-arrays-after-replacing-zeros
3194-find-words-containing-character
3213-count-subarrays-where-max-element-appears-at-least-k-times
3241-divide-array-into-arrays-with-max-difference
3242-count-elements-with-maximum-frequency
3251-maximum-area-of-longest-diagonal-rectangle
3278-find-the-number-of-ways-to-place-people-i
3291-find-if-array-can-be-sorted
3307-find-the-maximum-sum-of-node-values
3321-type-of-triangle
3372-longest-strictly-increasing-or-strictly-decreasing-subarray
3429-special-array-i
3490-find-the-maximum-length-of-valid-subsequence-i
3491-find-the-maximum-length-of-valid-subsequence-ii
3616-make-array-elements-equal-to-zero
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii
3639-zero-array-transformation-i
3647-zero-array-transformation-iii
3648-find-the-maximum-number-of-fruits-collected
3685-count-subarrays-of-length-three-with-a-condition
3741-reschedule-meetings-for-maximum-free-time-ii
3743-reschedule-meetings-for-maximum-free-time-i
3747-maximum-difference-between-adjacent-elements-in-a-circular-array
3788-maximum-unique-subarray-sum-after-deletion

Linked List

0002-add-two-numbers
0019-remove-nth-node-from-end-of-list
0237-delete-node-in-a-linked-list
0816-design-hashset
0817-design-hashmap
1411-convert-binary-number-in-a-linked-list-to-integer

Recursion

0002-add-two-numbers
0231-power-of-two
0342-power-of-four
1013-fibonacci-number
3600-find-the-k-th-character-in-string-game-i

Binary Search

0004-median-of-two-sorted-arrays
0034-find-first-and-last-position-of-element-in-sorted-array
0074-search-a-2d-matrix
0081-search-in-rotated-sorted-array-ii
0153-find-minimum-in-rotated-sorted-array
0240-search-a-2d-matrix-ii
0713-subarray-product-less-than-k
0794-swim-in-rising-water
0882-peak-index-in-a-mountain-array
0907-koko-eating-bananas
1851-maximum-number-of-events-that-can-be-attended-ii
2150-kth-smallest-product-of-two-sorted-arrays
2180-maximum-number-of-tasks-you-can-assign
2229-maximum-fruits-harvested-after-at-most-k-steps
2392-successful-pairs-of-spells-and-potions
2394-count-subarrays-with-score-less-than-k
2720-minimize-the-maximum-difference-of-pairs

Divide and Conquer

0004-median-of-two-sorted-arrays
0169-majority-element
0240-search-a-2d-matrix-ii
0347-top-k-frequent-elements
0948-sort-an-array

Sorting

0015-3sum
0049-group-anagrams
0075-sort-colors
0169-majority-element
0217-contains-duplicate
0229-majority-element-ii
0242-valid-anagram
0347-top-k-frequent-elements
0451-sort-characters-by-frequency
0594-longest-harmonious-subsequence
0948-sort-an-array
1256-rank-transform-of-an-array
1478-maximum-number-of-events-that-can-be-attended
1851-maximum-number-of-events-that-can-be-attended-ii
2160-minimum-operations-to-make-a-uni-value-grid
2180-maximum-number-of-tasks-you-can-assign
2215-finding-3-digit-even-numbers
2387-partition-array-such-that-maximum-difference-is-k
2392-successful-pairs-of-spells-and-potions
2689-rearranging-fruits
3241-divide-array-into-arrays-with-max-difference
3278-find-the-number-of-ways-to-place-people-i
3291-find-if-array-can-be-sorted
3307-find-the-maximum-sum-of-node-values
3321-type-of-triangle
3360-minimum-deletions-to-make-string-k-special
3647-zero-array-transformation-iii

Counting

0169-majority-element
0229-majority-element-ii
0347-top-k-frequent-elements
0451-sort-characters-by-frequency
0594-longest-harmonious-subsequence
1227-number-of-equivalent-domino-pairs
1510-find-lucky-integer-in-an-array
1915-check-if-one-string-swap-can-make-strings-equal
1986-largest-color-value-in-a-directed-graph
2140-longest-subsequence-repeated-k-times
2237-longest-palindrome-by-concatenating-two-letter-words
2525-count-number-of-distinct-integers-after-reverse-operations
3242-count-elements-with-maximum-frequency
3360-minimum-deletions-to-make-string-k-special
3629-total-characters-in-string-after-transformations-i
3630-total-characters-in-string-after-transformations-ii
3753-maximum-difference-between-even-and-odd-frequency-i
3754-maximum-manhattan-distance-after-k-changes

String

0003-longest-substring-without-repeating-characters
0008-string-to-integer-atoi
0013-roman-to-integer
0014-longest-common-prefix
0020-valid-parentheses
0049-group-anagrams
0125-valid-palindrome
0151-reverse-words-in-a-string
0165-compare-version-numbers
0242-valid-anagram
0344-reverse-string
0424-longest-repeating-character-replacement
0451-sort-characters-by-frequency
0812-rotate-string
0868-push-dominoes
0957-minimum-add-to-make-parentheses-valid
1078-remove-outermost-parentheses
1302-delete-characters-to-make-fancy-string
1737-maximum-nesting-depth-of-the-parentheses
1818-maximum-score-from-removing-substrings
1915-check-if-one-string-swap-can-make-strings-equal
2032-largest-odd-number-in-string
2140-longest-subsequence-repeated-k-times
2237-longest-palindrome-by-concatenating-two-letter-words
2260-divide-a-string-into-groups-of-size-k
2346-largest-3-same-digit-number-in-string
2520-using-a-robot-to-print-the-lexicographically-smallest-string
2580-circular-sentence
2800-minimum-string-length-after-removing-substrings
2847-find-maximum-number-of-string-pairs
2977-check-if-a-string-is-an-acronym-of-words
3142-longest-unequal-adjacent-groups-subsequence-ii
3143-longest-unequal-adjacent-groups-subsequence-i
3174-minimum-number-of-changes-to-make-binary-string-beautiful
3194-find-words-containing-character
3360-minimum-deletions-to-make-string-k-special
3396-valid-word
3445-lexicographically-minimum-string-after-removing-stars
3451-string-compression-iii
3617-find-the-original-typed-string-i
3629-total-characters-in-string-after-transformations-i
3630-total-characters-in-string-after-transformations-ii
3637-count-number-of-balanced-permutations
3683-find-the-lexicographically-largest-string-from-the-box-i
3753-maximum-difference-between-even-and-odd-frequency-i
3754-maximum-manhattan-distance-after-k-changes
3761-maximum-difference-between-even-and-odd-frequency-ii

Simulation

2048-build-array-from-permutation
2058-concatenation-of-array
2169-simple-bank-system
2260-divide-a-string-into-groups-of-size-k
2324-find-triangular-sum-of-an-array
2800-minimum-string-length-after-removing-substrings
2847-find-maximum-number-of-string-pairs
3600-find-the-k-th-character-in-string-game-i
3616-make-array-elements-equal-to-zero

Enumeration

2140-longest-subsequence-repeated-k-times
2170-count-number-of-maximum-bitwise-or-subsets
2202-sum-of-k-mirror-numbers
2215-finding-3-digit-even-numbers
2837-minimum-operations-to-make-the-integer-zero
3201-distribute-candies-among-children-ii
3278-find-the-number-of-ways-to-place-people-i
3683-find-the-lexicographically-largest-string-from-the-box-i
3741-reschedule-meetings-for-maximum-free-time-ii
3761-maximum-difference-between-even-and-odd-frequency-ii

Prefix Sum

0238-product-of-array-except-self
0713-subarray-product-less-than-k
1603-running-sum-of-1d-array
1694-make-sum-divisible-by-p
2229-maximum-fruits-harvested-after-at-most-k-steps
2394-count-subarrays-with-score-less-than-k
2529-range-product-queries-of-powers
3616-make-array-elements-equal-to-zero
3639-zero-array-transformation-i
3647-zero-array-transformation-iii
3761-maximum-difference-between-even-and-odd-frequency-ii

Stack

0020-valid-parentheses
0957-minimum-add-to-make-parentheses-valid
1002-maximum-width-ramp
1078-remove-outermost-parentheses
1737-maximum-nesting-depth-of-the-parentheses
1818-maximum-score-from-removing-substrings
2520-using-a-robot-to-print-the-lexicographically-smallest-string
2800-minimum-string-length-after-removing-substrings
3445-lexicographically-minimum-string-after-removing-stars

Greedy

0011-container-with-most-water
0135-candy
0957-minimum-add-to-make-parentheses-valid
1049-minimum-domino-rotations-for-equal-row
1448-maximum-69-number
1478-maximum-number-of-events-that-can-be-attended
1818-maximum-score-from-removing-substrings
2032-largest-odd-number-in-string
2140-longest-subsequence-repeated-k-times
2180-maximum-number-of-tasks-you-can-assign
2237-longest-palindrome-by-concatenating-two-letter-words
2387-partition-array-such-that-maximum-difference-is-k
2520-using-a-robot-to-print-the-lexicographically-smallest-string
2689-rearranging-fruits
2704-maximum-difference-by-remapping-a-digit
2720-minimize-the-maximum-difference-of-pairs
3143-longest-unequal-adjacent-groups-subsequence-i
3171-minimum-equal-sum-of-two-arrays-after-replacing-zeros
3241-divide-array-into-arrays-with-max-difference
3307-find-the-maximum-sum-of-node-values
3360-minimum-deletions-to-make-string-k-special
3445-lexicographically-minimum-string-after-removing-stars
3647-zero-array-transformation-iii
3741-reschedule-meetings-for-maximum-free-time-ii
3743-reschedule-meetings-for-maximum-free-time-i
3788-maximum-unique-subarray-sum-after-deletion

Monotonic Stack

1002-maximum-width-ramp

String Matching

0572-subtree-of-another-tree
0812-rotate-string

Bit Manipulation

0231-power-of-two
0342-power-of-four
2170-count-number-of-maximum-bitwise-or-subsets
2529-range-product-queries-of-powers
2837-minimum-operations-to-make-the-integer-zero
3291-find-if-array-can-be-sorted
3307-find-the-maximum-sum-of-node-values
3600-find-the-k-th-character-in-string-game-i
3676-smallest-number-with-all-set-bits

Sliding Window

0003-longest-substring-without-repeating-characters
0424-longest-repeating-character-replacement
0594-longest-harmonious-subsequence
0713-subarray-product-less-than-k
0867-new-21-game
0940-fruit-into-baskets
1813-maximum-erasure-value
2229-maximum-fruits-harvested-after-at-most-k-steps
2394-count-subarrays-with-score-less-than-k
3213-count-subarrays-where-max-element-appears-at-least-k-times
3743-reschedule-meetings-for-maximum-free-time-i
3761-maximum-difference-between-even-and-odd-frequency-ii

Tree

0100-same-tree
0104-maximum-depth-of-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0572-subtree-of-another-tree
3307-find-the-maximum-sum-of-node-values
3633-maximize-the-number-of-target-nodes-after-connecting-trees-i
3645-maximize-the-number-of-target-nodes-after-connecting-trees-ii

Depth-First Search

0100-same-tree
0104-maximum-depth-of-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0386-lexicographical-numbers
0572-subtree-of-another-tree
0794-swim-in-rising-water
2438-find-closest-node-to-given-two-nodes
3633-maximize-the-number-of-target-nodes-after-connecting-trees-i
3645-maximize-the-number-of-target-nodes-after-connecting-trees-ii

Breadth-First Search

0100-same-tree
0104-maximum-depth-of-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0794-swim-in-rising-water
0945-snakes-and-ladders
1424-maximum-candies-you-can-get-from-boxes
3633-maximize-the-number-of-target-nodes-after-connecting-trees-i
3645-maximize-the-number-of-target-nodes-after-connecting-trees-ii

Binary Tree

0100-same-tree
0104-maximum-depth-of-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0572-subtree-of-another-tree

Trie

0014-longest-common-prefix
0386-lexicographical-numbers
0440-k-th-smallest-in-lexicographical-order

Design

0816-design-hashset
0817-design-hashmap
1995-finding-pairs-with-a-certain-sum
2169-simple-bank-system

Hash Function

0572-subtree-of-another-tree
0816-design-hashset
0817-design-hashmap

Heap (Priority Queue)

0347-top-k-frequent-elements
0451-sort-characters-by-frequency
0794-swim-in-rising-water
0948-sort-an-array
1478-maximum-number-of-events-that-can-be-attended
3445-lexicographically-minimum-string-after-removing-stars
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii
3647-zero-array-transformation-iii

Bucket Sort

0347-top-k-frequent-elements
0451-sort-characters-by-frequency
0948-sort-an-array

Quickselect

0347-top-k-frequent-elements

Union Find

0128-longest-consecutive-sequence
0794-swim-in-rising-water

Dynamic Programming

0118-pascals-triangle
0121-best-time-to-buy-and-sell-stock
0806-domino-and-tromino-tiling
0826-soup-servings
0867-new-21-game
0868-push-dominoes
1013-fibonacci-number
1402-count-square-submatrices-with-all-ones
1851-maximum-number-of-events-that-can-be-attended-ii
1986-largest-color-value-in-a-directed-graph
2061-painting-a-grid-with-three-different-colors
2882-ways-to-express-an-integer-as-sum-of-powers
3142-longest-unequal-adjacent-groups-subsequence-ii
3143-longest-unequal-adjacent-groups-subsequence-i
3307-find-the-maximum-sum-of-node-values
3490-find-the-maximum-length-of-valid-subsequence-i
3491-find-the-maximum-length-of-valid-subsequence-ii
3629-total-characters-in-string-after-transformations-i
3630-total-characters-in-string-after-transformations-ii
3637-count-number-of-balanced-permutations
3648-find-the-maximum-number-of-fruits-collected

Matrix

0036-valid-sudoku
0073-set-matrix-zeroes
0074-search-a-2d-matrix
0240-search-a-2d-matrix-ii
0794-swim-in-rising-water
0945-snakes-and-ladders
1402-count-square-submatrices-with-all-ones
2160-minimum-operations-to-make-a-uni-value-grid
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii
3648-find-the-maximum-number-of-fruits-collected

Binary Search Tree

0235-lowest-common-ancestor-of-a-binary-search-tree

Queue

2180-maximum-number-of-tasks-you-can-assign

Monotonic Queue

2180-maximum-number-of-tasks-you-can-assign

Graph

1424-maximum-candies-you-can-get-from-boxes
1986-largest-color-value-in-a-directed-graph
2438-find-closest-node-to-given-two-nodes
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii

Shortest Path

3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii

Combinatorics

2324-find-triangular-sum-of-an-array
3201-distribute-candies-among-children-ii
3637-count-number-of-balanced-permutations
3682-count-the-number-of-arrays-with-k-matching-adjacent-elements

Topological Sort

1986-largest-color-value-in-a-directed-graph

Memoization

1013-fibonacci-number
1986-largest-color-value-in-a-directed-graph

Backtracking

0679-24-game
2140-longest-subsequence-repeated-k-times
2170-count-number-of-maximum-bitwise-or-subsets

Probability and Statistics

0826-soup-servings
0867-new-21-game

Geometry

0830-largest-triangle-area
3278-find-the-number-of-ways-to-place-people-i

Brainteaser

2837-minimum-operations-to-make-the-integer-zero

Merge Sort

0948-sort-an-array

Radix Sort

0948-sort-an-array

Counting Sort

0948-sort-an-array

About

so far dsa questions i have done or will do

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published