Skip to content

Collection of LeetCode questions to ace the coding interview! - Created using [LeetHub v2](https://github.com/arunbhardwaj/LeetHub-2.0)

Notifications You must be signed in to change notification settings

Yuvrajj07/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 v2

Array

0056-merge-intervals
0075-sort-colors
0078-subsets
0216-combination-sum-iii
0380-insert-delete-getrandom-o1
0645-set-mismatch
0853-most-profit-assigning-work
1217-relative-sort-array
1319-unique-number-of-occurrences

Sorting

0056-merge-intervals
0075-sort-colors
0645-set-mismatch
0853-most-profit-assigning-work
1217-relative-sort-array

Tree

0832-binary-tree-pruning
1021-distribute-coins-in-binary-tree

Depth-First Search

0832-binary-tree-pruning
1021-distribute-coins-in-binary-tree

Binary Tree

0832-binary-tree-pruning
1021-distribute-coins-in-binary-tree

Backtracking

0078-subsets
0216-combination-sum-iii

Bit Manipulation

0078-subsets
0645-set-mismatch

Hash Table

0380-insert-delete-getrandom-o1
0645-set-mismatch
1217-relative-sort-array
1319-unique-number-of-occurrences

Counting Sort

1217-relative-sort-array

Two Pointers

0075-sort-colors
0633-sum-of-square-numbers
0853-most-profit-assigning-work

Math

0380-insert-delete-getrandom-o1
0633-sum-of-square-numbers

Design

0380-insert-delete-getrandom-o1

Randomized

0380-insert-delete-getrandom-o1

Binary Search

0633-sum-of-square-numbers
0853-most-profit-assigning-work

Greedy

0853-most-profit-assigning-work

LeetCode Topics

Array

0011-container-with-most-water
0015-3sum
0031-next-permutation
0036-valid-sudoku
0054-spiral-matrix
0059-spiral-matrix-ii
0073-set-matrix-zeroes
0090-subsets-ii
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0164-maximum-gap
0179-largest-number
0189-rotate-array
0200-number-of-islands
0289-game-of-life
0442-find-all-duplicates-in-an-array
0452-minimum-number-of-arrows-to-burst-balloons
0539-minimum-time-difference
0560-subarray-sum-equals-k
0621-task-scheduler
0719-find-k-th-smallest-pair-distance
0724-find-pivot-index
0739-daily-temperatures
0843-binary-trees-with-factors
0853-most-profit-assigning-work
0917-boats-to-save-people
0948-sort-an-array
0982-minimum-increment-to-make-array-unique
0983-validate-stack-sequences
0985-bag-of-tokens
1273-compare-strings-by-frequency-of-the-smallest-character
1333-sort-the-jumbled-numbers
1396-count-servers-that-communicate
1468-check-if-n-and-its-double-exist
1477-product-of-the-last-k-numbers
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
1497-design-a-stack-with-increment-operation
1511-count-number-of-teams
1524-string-matching-in-an-array
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
1615-range-sum-of-sorted-subarray-sums
1620-check-if-array-pairs-are-divisible-by-k
1679-shortest-subarray-to-be-removed-to-make-array-sorted
1711-find-valid-matrix-given-row-and-column-sums
1720-crawler-log-folder
1741-sort-array-by-increasing-frequency
1786-count-the-number-of-consistent-strings
1803-average-waiting-time
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
2089-maximum-matrix-sum
2107-find-unique-binary-string
2148-minimum-number-of-moves-to-seat-everyone
2163-kth-distinct-string-in-an-array
2164-two-best-non-overlapping-events
2179-most-beautiful-item-for-each-query
2232-adding-spaces-to-a-string
2292-counting-words-with-a-given-prefix
2355-maximum-consecutive-floors-without-special-floors
2356-largest-combination-with-bitwise-and-greater-than-zero
2358-number-of-ways-to-split-array
2465-shifting-letters-ii
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2502-sort-the-people
2533-bitwise-xor-of-all-pairings
2552-maximum-sum-of-distinct-subarrays-with-length-k
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
2673-maximize-win-from-two-segments
2691-count-vowel-strings-in-ranges
2695-find-score-of-an-array-after-marking-all-elements
2716-prime-subtraction-operation
2727-number-of-senior-citizens
2766-find-the-prefix-common-array-of-two-arrays
2792-neighboring-bitwise-xor
3262-find-polygon-with-the-largest-perimeter
3291-find-if-array-can-be-sorted
3309-count-prefix-and-suffix-pairs-i
3351-maximize-happiness-of-selected-children
3380-shortest-subarray-with-or-at-least-k-ii
3434-find-the-number-of-distinct-colors-among-the-balls
3522-find-the-power-of-k-size-subarrays-i
3555-final-array-state-after-k-multiplication-operations-i

Two Pointers

0005-longest-palindromic-substring
0011-container-with-most-water
0015-3sum
0031-next-permutation
0125-valid-palindrome
0189-rotate-array
0567-permutation-in-string
0719-find-k-th-smallest-pair-distance
0853-most-profit-assigning-work
0917-boats-to-save-people
0985-bag-of-tokens
1468-check-if-n-and-its-double-exist
1615-range-sum-of-sorted-subarray-sums
1679-shortest-subarray-to-be-removed-to-make-array-sorted
1923-sentence-similarity-iii
1972-rotating-the-box
2095-minimum-number-of-swaps-to-make-the-string-balanced
2232-adding-spaces-to-a-string
2581-divide-players-into-teams-of-equal-skill
3018-make-string-a-subsequence-using-cyclic-increments

Sorting

0015-3sum
0164-maximum-gap
0179-largest-number
0451-sort-characters-by-frequency
0452-minimum-number-of-arrows-to-burst-balloons
0539-minimum-time-difference
0621-task-scheduler
0719-find-k-th-smallest-pair-distance
0843-binary-trees-with-factors
0853-most-profit-assigning-work
0917-boats-to-save-people
0948-sort-an-array
0982-minimum-increment-to-make-array-unique
0985-bag-of-tokens
1273-compare-strings-by-frequency-of-the-smallest-character
1333-sort-the-jumbled-numbers
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
1615-range-sum-of-sorted-subarray-sums
1741-sort-array-by-increasing-frequency
2148-minimum-number-of-moves-to-seat-everyone
2164-two-best-non-overlapping-events
2179-most-beautiful-item-for-each-query
2355-maximum-consecutive-floors-without-special-floors
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2502-sort-the-people
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
3262-find-polygon-with-the-largest-perimeter
3276-minimum-number-of-pushes-to-type-word-ii
3291-find-if-array-can-be-sorted
3351-maximize-happiness-of-selected-children

Tree

0103-binary-tree-zigzag-level-order-traversal
0145-binary-tree-postorder-traversal
0515-find-largest-value-in-each-tree-row
0789-kth-largest-element-in-a-stream
0832-binary-tree-pruning
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2646-kth-largest-sum-in-a-binary-tree
3439-find-minimum-diameter-after-merging-two-trees

Breadth-First Search

0103-binary-tree-zigzag-level-order-traversal
0200-number-of-islands
0515-find-largest-value-in-each-tree-row
1396-count-servers-that-communicate
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2646-kth-largest-sum-in-a-binary-tree
3439-find-minimum-diameter-after-merging-two-trees

Binary Tree

0103-binary-tree-zigzag-level-order-traversal
0145-binary-tree-postorder-traversal
0515-find-largest-value-in-each-tree-row
0789-kth-largest-element-in-a-stream
0832-binary-tree-pruning
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2646-kth-largest-sum-in-a-binary-tree

Design

0789-kth-largest-element-in-a-stream
1477-product-of-the-last-k-numbers
1497-design-a-stack-with-increment-operation
1955-seat-reservation-manager

Heap (Priority Queue)

0264-ugly-number-ii
0451-sort-characters-by-frequency
0621-task-scheduler
0789-kth-largest-element-in-a-stream
0948-sort-an-array
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
1917-maximum-average-pass-ratio
1955-seat-reservation-manager
2164-two-best-non-overlapping-events
2300-construct-string-with-repeat-limit
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2695-find-score-of-an-array-after-marking-all-elements
3555-final-array-state-after-k-multiplication-operations-i

Simulation

0043-multiply-strings
0054-spiral-matrix
0059-spiral-matrix-ii
0289-game-of-life
0983-validate-stack-sequences
1803-average-waiting-time
2021-remove-all-occurrences-of-a-substring
2232-adding-spaces-to-a-string
2695-find-score-of-an-array-after-marking-all-elements
2800-minimum-string-length-after-removing-substrings
3434-find-the-number-of-distinct-colors-among-the-balls
3555-final-array-state-after-k-multiplication-operations-i

String

0005-longest-palindromic-substring
0008-string-to-integer-atoi
0043-multiply-strings
0125-valid-palindrome
0179-largest-number
0423-reconstruct-original-digits-from-english
0451-sort-characters-by-frequency
0539-minimum-time-difference
0567-permutation-in-string
0812-rotate-string
0920-uncommon-words-from-two-sentences
1273-compare-strings-by-frequency-of-the-smallest-character
1298-reverse-substrings-between-each-pair-of-parentheses
1369-minimum-swaps-to-make-strings-equal
1473-find-the-longest-substring-containing-vowels-in-even-counts
1502-construct-k-palindrome-strings
1524-string-matching-in-an-array
1720-crawler-log-folder
1737-maximum-nesting-depth-of-the-parentheses
1786-count-the-number-of-consistent-strings
1923-sentence-similarity-iii
2021-remove-all-occurrences-of-a-substring
2059-unique-length-3-palindromic-subsequences
2095-minimum-number-of-swaps-to-make-the-string-balanced
2107-find-unique-binary-string
2149-remove-colored-pieces-if-both-neighbors-are-the-same-color
2163-kth-distinct-string-in-an-array
2221-check-if-a-parentheses-string-can-be-valid
2232-adding-spaces-to-a-string
2292-counting-words-with-a-given-prefix
2300-construct-string-with-repeat-limit
2465-shifting-letters-ii
2502-sort-the-people
2599-take-k-of-each-character-from-left-and-right
2691-count-vowel-strings-in-ranges
2727-number-of-senior-citizens
2800-minimum-string-length-after-removing-substrings
3018-make-string-a-subsequence-using-cyclic-increments
3055-maximum-odd-binary-number
3276-minimum-number-of-pushes-to-type-word-ii
3309-count-prefix-and-suffix-pairs-i
3451-string-compression-iii
3455-minimum-length-of-string-after-operations

Stack

0145-binary-tree-postorder-traversal
0739-daily-temperatures
0983-validate-stack-sequences
1298-reverse-substrings-between-each-pair-of-parentheses
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
1720-crawler-log-folder
1737-maximum-nesting-depth-of-the-parentheses
2021-remove-all-occurrences-of-a-substring
2095-minimum-number-of-swaps-to-make-the-string-balanced
2221-check-if-a-parentheses-string-can-be-valid
2800-minimum-string-length-after-removing-substrings

Greedy

0011-container-with-most-water
0122-best-time-to-buy-and-sell-stock-ii
0179-largest-number
0452-minimum-number-of-arrows-to-burst-balloons
0621-task-scheduler
0670-maximum-swap
0853-most-profit-assigning-work
0917-boats-to-save-people
0982-minimum-increment-to-make-array-unique
0985-bag-of-tokens
1369-minimum-swaps-to-make-strings-equal
1502-construct-k-palindrome-strings
1604-least-number-of-unique-integers-after-k-removals
1711-find-valid-matrix-given-row-and-column-sums
1917-maximum-average-pass-ratio
2089-maximum-matrix-sum
2095-minimum-number-of-swaps-to-make-the-string-balanced
2148-minimum-number-of-moves-to-seat-everyone
2149-remove-colored-pieces-if-both-neighbors-are-the-same-color
2221-check-if-a-parentheses-string-can-be-valid
2300-construct-string-with-repeat-limit
2509-minimize-xor
2640-maximum-number-of-integers-to-choose-from-a-range-i
2716-prime-subtraction-operation
3055-maximum-odd-binary-number
3262-find-polygon-with-the-largest-perimeter
3276-minimum-number-of-pushes-to-type-word-ii
3351-maximize-happiness-of-selected-children

Prefix Sum

0560-subarray-sum-equals-k
0724-find-pivot-index
1473-find-the-longest-substring-containing-vowels-in-even-counts
1477-product-of-the-last-k-numbers
1940-maximum-xor-for-each-query
2059-unique-length-3-palindromic-subsequences
2358-number-of-ways-to-split-array
2465-shifting-letters-ii
2691-count-vowel-strings-in-ranges
3262-find-polygon-with-the-largest-perimeter

Matrix

0036-valid-sudoku
0054-spiral-matrix
0059-spiral-matrix-ii
0073-set-matrix-zeroes
0200-number-of-islands
0289-game-of-life
1396-count-servers-that-communicate
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
1711-find-valid-matrix-given-row-and-column-sums
1972-rotating-the-box
2089-maximum-matrix-sum

Hash Table

0036-valid-sudoku
0073-set-matrix-zeroes
0264-ugly-number-ii
0423-reconstruct-original-digits-from-english
0442-find-all-duplicates-in-an-array
0451-sort-characters-by-frequency
0560-subarray-sum-equals-k
0567-permutation-in-string
0621-task-scheduler
0843-binary-trees-with-factors
0920-uncommon-words-from-two-sentences
1273-compare-strings-by-frequency-of-the-smallest-character
1468-check-if-n-and-its-double-exist
1473-find-the-longest-substring-containing-vowels-in-even-counts
1502-construct-k-palindrome-strings
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
1741-sort-array-by-increasing-frequency
1786-count-the-number-of-consistent-strings
2059-unique-length-3-palindromic-subsequences
2107-find-unique-binary-string
2163-kth-distinct-string-in-an-array
2300-construct-string-with-repeat-limit
2356-largest-combination-with-bitwise-and-greater-than-zero
2473-max-sum-of-a-pair-with-equal-sum-of-digits
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
2695-find-score-of-an-array-after-marking-all-elements
2766-find-the-prefix-common-array-of-two-arrays
3276-minimum-number-of-pushes-to-type-word-ii
3434-find-the-number-of-distinct-colors-among-the-balls
3455-minimum-length-of-string-after-operations

Database

0570-managers-with-at-least-5-direct-reports
0584-find-customer-referee
0595-big-countries
1258-article-views-i
1827-invalid-tweets
1908-recyclable-and-low-fat-products

Divide and Conquer

0948-sort-an-array

Merge Sort

0948-sort-an-array

Bucket Sort

0164-maximum-gap
0451-sort-characters-by-frequency
0948-sort-an-array

Radix Sort

0164-maximum-gap
0948-sort-an-array

Counting Sort

0451-sort-characters-by-frequency
0621-task-scheduler
0920-uncommon-words-from-two-sentences
0948-sort-an-array
0982-minimum-increment-to-make-array-unique
1396-count-servers-that-communicate
1502-construct-k-palindrome-strings
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
2148-minimum-number-of-moves-to-seat-everyone
2163-kth-distinct-string-in-an-array
2300-construct-string-with-repeat-limit
2356-largest-combination-with-bitwise-and-greater-than-zero
3276-minimum-number-of-pushes-to-type-word-ii
3455-minimum-length-of-string-after-operations

Dynamic Programming

0005-longest-palindromic-substring
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0264-ugly-number-ii
0843-binary-trees-with-factors
1013-fibonacci-number
1456-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance
1511-count-number-of-teams
2164-two-best-non-overlapping-events
2586-longest-square-streak-in-an-array

Graph

1456-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
3189-find-champion-ii
3439-find-minimum-diameter-after-merging-two-trees

Shortest Path

1456-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid

Binary Indexed Tree

1511-count-number-of-teams

Math

0002-add-two-numbers
0043-multiply-strings
0172-factorial-trailing-zeroes
0189-rotate-array
0231-power-of-two
0263-ugly-number
0264-ugly-number-ii
0371-sum-of-two-integers
0423-reconstruct-original-digits-from-english
0539-minimum-time-difference
0670-maximum-swap
1013-fibonacci-number
1369-minimum-swaps-to-make-strings-equal
1477-product-of-the-last-k-numbers
2149-remove-colored-pieces-if-both-neighbors-are-the-same-color
2716-prime-subtraction-operation
3055-maximum-odd-binary-number
3555-final-array-state-after-k-multiplication-operations-i

Binary Search

0719-find-k-th-smallest-pair-distance
0853-most-profit-assigning-work
1273-compare-strings-by-frequency-of-the-smallest-character
1468-check-if-n-and-its-double-exist
1615-range-sum-of-sorted-subarray-sums
1679-shortest-subarray-to-be-removed-to-make-array-sorted
1886-minimum-limit-of-balls-in-a-bag
2164-two-best-non-overlapping-events
2179-most-beautiful-item-for-each-query
2586-longest-square-streak-in-an-array
2640-maximum-number-of-integers-to-choose-from-a-range-i
2673-maximize-win-from-two-segments
2716-prime-subtraction-operation

Bit Manipulation

0090-subsets-ii
0231-power-of-two
0371-sum-of-two-integers
1473-find-the-longest-substring-containing-vowels-in-even-counts
1786-count-the-number-of-consistent-strings
1940-maximum-xor-for-each-query
2059-unique-length-3-palindromic-subsequences
2356-largest-combination-with-bitwise-and-greater-than-zero
2509-minimize-xor
2533-bitwise-xor-of-all-pairings
2766-find-the-prefix-common-array-of-two-arrays
2792-neighboring-bitwise-xor
3291-find-if-array-can-be-sorted
3380-shortest-subarray-with-or-at-least-k-ii
3394-minimum-array-end

Depth-First Search

0145-binary-tree-postorder-traversal
0200-number-of-islands
0386-lexicographical-numbers
0515-find-largest-value-in-each-tree-row
0832-binary-tree-pruning
1396-count-servers-that-communicate
3439-find-minimum-diameter-after-merging-two-trees

Monotonic Stack

0739-daily-temperatures
1570-final-prices-with-a-special-discount-in-a-shop
1679-shortest-subarray-to-be-removed-to-make-array-sorted

Binary Search Tree

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

Data Stream

0789-kth-largest-element-in-a-stream
1477-product-of-the-last-k-numbers

Recursion

0002-add-two-numbers
0024-swap-nodes-in-pairs
0231-power-of-two
1013-fibonacci-number

Memoization

1013-fibonacci-number

Linked List

0002-add-two-numbers
0024-swap-nodes-in-pairs

Trie

0386-lexicographical-numbers
3309-count-prefix-and-suffix-pairs-i

Sliding Window

0567-permutation-in-string
2552-maximum-sum-of-distinct-subarrays-with-length-k
2599-take-k-of-each-character-from-left-and-right
2673-maximize-win-from-two-segments
3380-shortest-subarray-with-or-at-least-k-ii
3522-find-the-power-of-k-size-subarrays-i

Union Find

0200-number-of-islands
1396-count-servers-that-communicate

String Matching

0812-rotate-string
1524-string-matching-in-an-array
2292-counting-words-with-a-given-prefix
3309-count-prefix-and-suffix-pairs-i

Game Theory

2149-remove-colored-pieces-if-both-neighbors-are-the-same-color

Backtracking

0090-subsets-ii
2107-find-unique-binary-string

Number Theory

2716-prime-subtraction-operation

Rolling Hash

3309-count-prefix-and-suffix-pairs-i

Hash Function

3309-count-prefix-and-suffix-pairs-i

Brainteaser

2533-bitwise-xor-of-all-pairings

About

Collection of LeetCode questions to ace the coding interview! - Created using [LeetHub v2](https://github.com/arunbhardwaj/LeetHub-2.0)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages