Skip to content

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

Notifications You must be signed in to change notification settings

Aadarsh45/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https-github.com-Aadarsh45-leetcode-solution

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

LeetCode Topics

Array

0011-container-with-most-water
0015-3sum
0018-4sum
0026-remove-duplicates-from-sorted-array
0031-next-permutation
0040-combination-sum-ii
0042-trapping-rain-water
0048-rotate-image
0049-group-anagrams
0053-maximum-subarray
0056-merge-intervals
0063-unique-paths-ii
0064-minimum-path-sum
0073-set-matrix-zeroes
0074-search-a-2d-matrix
0075-sort-colors
0088-merge-sorted-array
0090-subsets-ii
0118-pascals-triangle
0120-triangle
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0128-longest-consecutive-sequence
0130-surrounded-regions
0150-evaluate-reverse-polish-notation
0169-majority-element
0179-largest-number
0198-house-robber
0213-house-robber-ii
0229-majority-element-ii
0287-find-the-duplicate-number
0322-coin-change
0347-top-k-frequent-elements
0416-partition-equal-subset-sum
0493-reverse-pairs
0494-target-sum
0518-coin-change-ii
0539-minimum-time-difference
0542-01-matrix
0624-maximum-distance-in-arrays
0632-smallest-range-covering-elements-from-k-lists
0689-maximum-sum-of-3-non-overlapping-subarrays
0721-accounts-merge
0729-my-calendar-i
0733-flood-fill
0739-daily-temperatures
0780-max-chunks-to-make-sorted
0859-design-circular-deque
0870-magic-squares-in-grid
0906-walking-robot-simulation
0921-spiral-matrix-iii
0967-minimum-falling-path-sum
0999-regions-cut-by-slashes
1036-rotting-oranges
1063-best-sightseeing-pair
1171-shortest-path-in-binary-matrix
1196-filling-bookcase-shelves
1240-stone-game-ii
1256-rank-transform-of-an-array
1325-path-with-maximum-probability
1524-string-matching-in-an-array
1556-make-two-arrays-equal-by-reversing-subarrays
1570-final-prices-with-a-special-discount-in-a-shop
1620-check-if-array-pairs-are-divisible-by-k
1691-minimum-number-of-days-to-disconnect-island
1694-make-sum-divisible-by-p
1744-number-of-ways-to-form-a-target-string-given-a-dictionary
1753-path-with-minimum-effort
1786-count-the-number-of-consistent-strings
1895-minimum-number-of-operations-to-move-all-balls-to-each-box
1923-sentence-similarity-iii
2006-find-the-student-that-will-replace-the-chalk
2054-the-number-of-the-smallest-unoccupied-chair
2067-maximum-number-of-points-with-cost
2179-most-beautiful-item-for-each-query
2292-counting-words-with-a-given-prefix
2358-number-of-ways-to-split-array
2488-divide-intervals-into-minimum-number-of-groups
2494-sum-of-prefix-scores-of-strings
2503-longest-subarray-with-maximum-bitwise-and
2581-divide-players-into-teams-of-equal-skill
2586-longest-square-streak-in-an-array
2691-count-vowel-strings-in-ranges
2716-prime-subtraction-operation
2727-number-of-senior-citizens
2755-extra-characters-in-a-string
2891-maximum-beauty-of-an-array-after-applying-operation
3181-find-building-where-alice-and-bob-can-meet
3519-find-the-number-of-winning-players
3526-minimum-number-of-flips-to-make-binary-grid-palindromic-i

Dynamic Programming

0010-regular-expression-matching
0022-generate-parentheses
0042-trapping-rain-water
0044-wildcard-matching
0053-maximum-subarray
0062-unique-paths
0063-unique-paths-ii
0064-minimum-path-sum
0072-edit-distance
0115-distinct-subsequences
0118-pascals-triangle
0120-triangle
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0131-palindrome-partitioning
0198-house-robber
0213-house-robber-ii
0241-different-ways-to-add-parentheses
0264-ugly-number-ii
0322-coin-change
0416-partition-equal-subset-sum
0494-target-sum
0518-coin-change-ii
0542-01-matrix
0583-delete-operation-for-two-strings
0650-2-keys-keyboard
0689-maximum-sum-of-3-non-overlapping-subarrays
0803-cheapest-flights-within-k-stops
0967-minimum-falling-path-sum
1063-best-sightseeing-pair
1196-filling-bookcase-shelves
1240-stone-game-ii
1250-longest-common-subsequence
1456-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance
1744-number-of-ways-to-form-a-target-string-given-a-dictionary
2067-maximum-number-of-points-with-cost
2090-number-of-ways-to-arrive-at-destination
2586-longest-square-streak-in-an-array
2755-extra-characters-in-a-string

Graph

0547-number-of-provinces
0801-is-graph-bipartite
0803-cheapest-flights-within-k-stops
0984-most-stones-removed-with-same-row-or-column
1325-path-with-maximum-probability
1442-number-of-operations-to-make-network-connected
1456-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance
2090-number-of-ways-to-arrive-at-destination
3439-find-minimum-diameter-after-merging-two-trees

Shortest Path

0803-cheapest-flights-within-k-stops
1325-path-with-maximum-probability
1456-find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance
2090-number-of-ways-to-arrive-at-destination

Depth-First Search

0130-surrounded-regions
0515-find-largest-value-in-each-tree-row
0547-number-of-provinces
0721-accounts-merge
0733-flood-fill
0801-is-graph-bipartite
0803-cheapest-flights-within-k-stops
0984-most-stones-removed-with-same-row-or-column
0999-regions-cut-by-slashes
1029-vertical-order-traversal-of-a-binary-tree
1442-number-of-operations-to-make-network-connected
1484-linked-list-in-binary-tree
1691-minimum-number-of-days-to-disconnect-island
1753-path-with-minimum-effort
2493-reverse-odd-levels-of-binary-tree
2677-cousins-in-binary-tree-ii
3058-maximum-number-of-k-divisible-components
3439-find-minimum-diameter-after-merging-two-trees

Breadth-First Search

0103-binary-tree-zigzag-level-order-traversal
0130-surrounded-regions
0322-coin-change
0515-find-largest-value-in-each-tree-row
0542-01-matrix
0547-number-of-provinces
0721-accounts-merge
0733-flood-fill
0801-is-graph-bipartite
0803-cheapest-flights-within-k-stops
0999-regions-cut-by-slashes
1029-vertical-order-traversal-of-a-binary-tree
1036-rotting-oranges
1171-shortest-path-in-binary-matrix
1442-number-of-operations-to-make-network-connected
1484-linked-list-in-binary-tree
1691-minimum-number-of-days-to-disconnect-island
1753-path-with-minimum-effort
2493-reverse-odd-levels-of-binary-tree
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2677-cousins-in-binary-tree-ii
3439-find-minimum-diameter-after-merging-two-trees

Union Find

0128-longest-consecutive-sequence
0130-surrounded-regions
0547-number-of-provinces
0721-accounts-merge
0801-is-graph-bipartite
0984-most-stones-removed-with-same-row-or-column
0999-regions-cut-by-slashes
1442-number-of-operations-to-make-network-connected
1753-path-with-minimum-effort

Hash Table

0003-longest-substring-without-repeating-characters
0049-group-anagrams
0073-set-matrix-zeroes
0128-longest-consecutive-sequence
0138-copy-list-with-random-pointer
0141-linked-list-cycle
0160-intersection-of-two-linked-lists
0169-majority-element
0208-implement-trie-prefix-tree
0229-majority-element-ii
0242-valid-anagram
0264-ugly-number-ii
0347-top-k-frequent-elements
0632-smallest-range-covering-elements-from-k-lists
0721-accounts-merge
0870-magic-squares-in-grid
0906-walking-robot-simulation
0920-uncommon-words-from-two-sentences
0984-most-stones-removed-with-same-row-or-column
0999-regions-cut-by-slashes
1029-vertical-order-traversal-of-a-binary-tree
1256-rank-transform-of-an-array
1473-find-the-longest-substring-containing-vowels-in-even-counts
1556-make-two-arrays-equal-by-reversing-subarrays
1620-check-if-array-pairs-are-divisible-by-k
1694-make-sum-divisible-by-p
1786-count-the-number-of-consistent-strings
2054-the-number-of-the-smallest-unoccupied-chair
2059-unique-length-3-palindromic-subsequences
2581-divide-players-into-teams-of-equal-skill
2586-longest-square-streak-in-an-array
2677-cousins-in-binary-tree-ii
2755-extra-characters-in-a-string
3519-find-the-number-of-winning-players

String

0003-longest-substring-without-repeating-characters
0010-regular-expression-matching
0020-valid-parentheses
0022-generate-parentheses
0044-wildcard-matching
0049-group-anagrams
0072-edit-distance
0115-distinct-subsequences
0131-palindrome-partitioning
0179-largest-number
0208-implement-trie-prefix-tree
0214-shortest-palindrome
0241-different-ways-to-add-parentheses
0242-valid-anagram
0273-integer-to-english-words
0539-minimum-time-difference
0564-find-the-closest-palindrome
0583-delete-operation-for-two-strings
0592-fraction-addition-and-subtraction
0721-accounts-merge
0920-uncommon-words-from-two-sentences
1250-longest-common-subsequence
1473-find-the-longest-substring-containing-vowels-in-even-counts
1524-string-matching-in-an-array
1537-maximum-score-after-splitting-a-string
1744-number-of-ways-to-form-a-target-string-given-a-dictionary
1786-count-the-number-of-consistent-strings
1895-minimum-number-of-operations-to-move-all-balls-to-each-box
1923-sentence-similarity-iii
2059-unique-length-3-palindromic-subsequences
2095-minimum-number-of-swaps-to-make-the-string-balanced
2221-check-if-a-parentheses-string-can-be-valid
2292-counting-words-with-a-given-prefix
2494-sum-of-prefix-scores-of-strings
2691-count-vowel-strings-in-ranges
2727-number-of-senior-citizens
2755-extra-characters-in-a-string

Sorting

0015-3sum
0018-4sum
0049-group-anagrams
0056-merge-intervals
0075-sort-colors
0088-merge-sorted-array
0169-majority-element
0179-largest-number
0229-majority-element-ii
0242-valid-anagram
0347-top-k-frequent-elements
0539-minimum-time-difference
0632-smallest-range-covering-elements-from-k-lists
0721-accounts-merge
0780-max-chunks-to-make-sorted
1029-vertical-order-traversal-of-a-binary-tree
1256-rank-transform-of-an-array
1556-make-two-arrays-equal-by-reversing-subarrays
2179-most-beautiful-item-for-each-query
2488-divide-intervals-into-minimum-number-of-groups
2581-divide-players-into-teams-of-equal-skill
2586-longest-square-streak-in-an-array
2891-maximum-beauty-of-an-array-after-applying-operation

Divide and Conquer

0053-maximum-subarray
0169-majority-element
0347-top-k-frequent-elements
0493-reverse-pairs

Heap (Priority Queue)

0264-ugly-number-ii
0347-top-k-frequent-elements
0632-smallest-range-covering-elements-from-k-lists
0789-kth-largest-element-in-a-stream
0803-cheapest-flights-within-k-stops
1325-path-with-maximum-probability
1753-path-with-minimum-effort
2054-the-number-of-the-smallest-unoccupied-chair
2488-divide-intervals-into-minimum-number-of-groups
3181-find-building-where-alice-and-bob-can-meet

Bucket Sort

0347-top-k-frequent-elements

Counting

0169-majority-element
0229-majority-element-ii
0347-top-k-frequent-elements
0920-uncommon-words-from-two-sentences
1620-check-if-array-pairs-are-divisible-by-k
1786-count-the-number-of-consistent-strings
2494-sum-of-prefix-scores-of-strings
3519-find-the-number-of-winning-players

Quickselect

0347-top-k-frequent-elements

Two Pointers

0011-container-with-most-water
0015-3sum
0018-4sum
0019-remove-nth-node-from-end-of-list
0026-remove-duplicates-from-sorted-array
0031-next-permutation
0042-trapping-rain-water
0061-rotate-list
0075-sort-colors
0088-merge-sorted-array
0141-linked-list-cycle
0160-intersection-of-two-linked-lists
0287-find-the-duplicate-number
0908-middle-of-the-linked-list
1923-sentence-similarity-iii
2095-minimum-number-of-swaps-to-make-the-string-balanced
2488-divide-intervals-into-minimum-number-of-groups
2581-divide-players-into-teams-of-equal-skill
3526-minimum-number-of-flips-to-make-binary-grid-palindromic-i

Matrix

0048-rotate-image
0063-unique-paths-ii
0064-minimum-path-sum
0073-set-matrix-zeroes
0074-search-a-2d-matrix
0130-surrounded-regions
0542-01-matrix
0733-flood-fill
0870-magic-squares-in-grid
0921-spiral-matrix-iii
0967-minimum-falling-path-sum
0999-regions-cut-by-slashes
1036-rotting-oranges
1171-shortest-path-in-binary-matrix
1691-minimum-number-of-days-to-disconnect-island
1753-path-with-minimum-effort
3526-minimum-number-of-flips-to-make-binary-grid-palindromic-i

Math

0002-add-two-numbers
0048-rotate-image
0050-powx-n
0062-unique-paths
0150-evaluate-reverse-polish-notation
0241-different-ways-to-add-parentheses
0264-ugly-number-ii
0273-integer-to-english-words
0539-minimum-time-difference
0564-find-the-closest-palindrome
0592-fraction-addition-and-subtraction
0650-2-keys-keyboard
0870-magic-squares-in-grid
1240-stone-game-ii
2716-prime-subtraction-operation

Recursion

0002-add-two-numbers
0010-regular-expression-matching
0025-reverse-nodes-in-k-group
0044-wildcard-matching
0050-powx-n
0206-reverse-linked-list
0241-different-ways-to-add-parentheses
0273-integer-to-english-words

Simulation

0592-fraction-addition-and-subtraction
0906-walking-robot-simulation
0921-spiral-matrix-iii
2006-find-the-student-that-will-replace-the-chalk

Strongly Connected Component

1691-minimum-number-of-days-to-disconnect-island

Tree

0103-binary-tree-zigzag-level-order-traversal
0515-find-largest-value-in-each-tree-row
0789-kth-largest-element-in-a-stream
1029-vertical-order-traversal-of-a-binary-tree
1484-linked-list-in-binary-tree
2493-reverse-odd-levels-of-binary-tree
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2677-cousins-in-binary-tree-ii
3058-maximum-number-of-k-divisible-components
3439-find-minimum-diameter-after-merging-two-trees

Design

0208-implement-trie-prefix-tree
0729-my-calendar-i
0789-kth-largest-element-in-a-stream
0859-design-circular-deque

Binary Search Tree

0074-search-a-2d-matrix
0287-find-the-duplicate-number
0493-reverse-pairs
0729-my-calendar-i
0789-kth-largest-element-in-a-stream
1753-path-with-minimum-effort
2006-find-the-student-that-will-replace-the-chalk
2179-most-beautiful-item-for-each-query
2586-longest-square-streak-in-an-array
2716-prime-subtraction-operation
2891-maximum-beauty-of-an-array-after-applying-operation
3181-find-building-where-alice-and-bob-can-meet

Binary Tree

0103-binary-tree-zigzag-level-order-traversal
0515-find-largest-value-in-each-tree-row
0789-kth-largest-element-in-a-stream
1029-vertical-order-traversal-of-a-binary-tree
1484-linked-list-in-binary-tree
2493-reverse-odd-levels-of-binary-tree
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2677-cousins-in-binary-tree-ii

Data Stream

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

Greedy

0011-container-with-most-water
0044-wildcard-matching
0122-best-time-to-buy-and-sell-stock-ii
0179-largest-number
0624-maximum-distance-in-arrays
0632-smallest-range-covering-elements-from-k-lists
0780-max-chunks-to-make-sorted
2095-minimum-number-of-swaps-to-make-the-string-balanced
2221-check-if-a-parentheses-string-can-be-valid
2488-divide-intervals-into-minimum-number-of-groups
2716-prime-subtraction-operation

Stack

0020-valid-parentheses
0042-trapping-rain-water
0150-evaluate-reverse-polish-notation
0739-daily-temperatures
0780-max-chunks-to-make-sorted
1570-final-prices-with-a-special-discount-in-a-shop
2095-minimum-number-of-swaps-to-make-the-string-balanced
2221-check-if-a-parentheses-string-can-be-valid
3181-find-building-where-alice-and-bob-can-meet

Monotonic Stack

0042-trapping-rain-water
0739-daily-temperatures
0780-max-chunks-to-make-sorted
1570-final-prices-with-a-special-discount-in-a-shop
3181-find-building-where-alice-and-bob-can-meet

Prefix Sum

1240-stone-game-ii
1473-find-the-longest-substring-containing-vowels-in-even-counts
1537-maximum-score-after-splitting-a-string
1694-make-sum-divisible-by-p
1895-minimum-number-of-operations-to-move-all-balls-to-each-box
2006-find-the-student-that-will-replace-the-chalk
2059-unique-length-3-palindromic-subsequences
2358-number-of-ways-to-split-array
2488-divide-intervals-into-minimum-number-of-groups
2691-count-vowel-strings-in-ranges

Game Theory

1240-stone-game-ii

Bit Manipulation

0090-subsets-ii
0287-find-the-duplicate-number
0476-number-complement
1473-find-the-longest-substring-containing-vowels-in-even-counts
1786-count-the-number-of-consistent-strings
2059-unique-length-3-palindromic-subsequences
2323-minimum-bit-flips-to-convert-number
2503-longest-subarray-with-maximum-bitwise-and

Backtracking

0022-generate-parentheses
0040-combination-sum-ii
0090-subsets-ii
0131-palindrome-partitioning
0494-target-sum

Linked List

0002-add-two-numbers
0019-remove-nth-node-from-end-of-list
0025-reverse-nodes-in-k-group
0061-rotate-list
0138-copy-list-with-random-pointer
0141-linked-list-cycle
0160-intersection-of-two-linked-lists
0206-reverse-linked-list
0725-split-linked-list-in-parts
0859-design-circular-deque
0908-middle-of-the-linked-list
1484-linked-list-in-binary-tree

Brainteaser

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

Combinatorics

0062-unique-paths

Binary Indexed Tree

0493-reverse-pairs
3181-find-building-where-alice-and-bob-can-meet

Segment Tree

0493-reverse-pairs
0729-my-calendar-i
3181-find-building-where-alice-and-bob-can-meet

Merge Sort

0493-reverse-pairs

Ordered Set

0493-reverse-pairs
0729-my-calendar-i

Sliding Window

0003-longest-substring-without-repeating-characters
0632-smallest-range-covering-elements-from-k-lists
2891-maximum-beauty-of-an-array-after-applying-operation

Memoization

0241-different-ways-to-add-parentheses

Rolling Hash

0214-shortest-palindrome

String Matching

0214-shortest-palindrome
1524-string-matching-in-an-array
2292-counting-words-with-a-given-prefix

Hash Function

0214-shortest-palindrome

Trie

0208-implement-trie-prefix-tree
0440-k-th-smallest-in-lexicographical-order
2494-sum-of-prefix-scores-of-strings
2755-extra-characters-in-a-string

Queue

0859-design-circular-deque

Database

0595-big-countries
1258-article-views-i
1827-invalid-tweets

Number Theory

2716-prime-subtraction-operation

Topological Sort

2090-number-of-ways-to-arrive-at-destination

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages