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

nayanaharsha06/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

0001-two-sum
0004-median-of-two-sorted-arrays
0015-3sum
0033-search-in-rotated-sorted-array
0036-valid-sudoku
0039-combination-sum
0040-combination-sum-ii
0042-trapping-rain-water
0046-permutations
0048-rotate-image
0049-group-anagrams
0054-spiral-matrix
0055-jump-game
0066-plus-one
0074-search-a-2d-matrix
0079-word-search
0084-largest-rectangle-in-histogram
0090-subsets-ii
0121-best-time-to-buy-and-sell-stock
0128-longest-consecutive-sequence
0136-single-number
0153-find-minimum-in-rotated-sorted-array
0167-two-sum-ii-input-array-is-sorted
0198-house-robber
0215-kth-largest-element-in-an-array
0238-product-of-array-except-self
0239-sliding-window-maximum
0268-missing-number
0287-find-the-duplicate-number
0347-top-k-frequent-elements
0739-daily-temperatures
0747-min-cost-climbing-stairs
0792-binary-search
0883-car-fleet
1127-last-stone-weight
2026-merge-triplets-to-form-target-triplet

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0036-valid-sudoku
0049-group-anagrams
0076-minimum-window-substring
0128-longest-consecutive-sequence
0138-copy-list-with-random-pointer
0141-linked-list-cycle
0202-happy-number
0242-valid-anagram
0268-missing-number
0347-top-k-frequent-elements
0424-longest-repeating-character-replacement
0567-permutation-in-string
0768-partition-labels
1023-time-based-key-value-store

Union Find

0128-longest-consecutive-sequence

Two Pointers

0015-3sum
0019-remove-nth-node-from-end-of-list
0042-trapping-rain-water
0141-linked-list-cycle
0143-reorder-list
0167-two-sum-ii-input-array-is-sorted
0202-happy-number
0287-find-the-duplicate-number
0567-permutation-in-string
0768-partition-labels

Sorting

0015-3sum
0049-group-anagrams
0215-kth-largest-element-in-an-array
0242-valid-anagram
0268-missing-number
0347-top-k-frequent-elements
0883-car-fleet

Stack

0020-valid-parentheses
0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0143-reorder-list
0678-valid-parenthesis-string
0739-daily-temperatures
0883-car-fleet

Monotonic Stack

0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0739-daily-temperatures
0883-car-fleet

Dynamic Programming

0042-trapping-rain-water
0055-jump-game
0070-climbing-stairs
0121-best-time-to-buy-and-sell-stock
0124-binary-tree-maximum-path-sum
0198-house-robber
0678-valid-parenthesis-string
0747-min-cost-climbing-stairs

Binary Search

0004-median-of-two-sorted-arrays
0033-search-in-rotated-sorted-array
0074-search-a-2d-matrix
0153-find-minimum-in-rotated-sorted-array
0268-missing-number
0287-find-the-duplicate-number
0792-binary-search
1023-time-based-key-value-store

Matrix

0036-valid-sudoku
0048-rotate-image
0054-spiral-matrix
0074-search-a-2d-matrix
0079-word-search

String

0003-longest-substring-without-repeating-characters
0076-minimum-window-substring
0424-longest-repeating-character-replacement
0567-permutation-in-string
1023-time-based-key-value-store

Sliding Window

0003-longest-substring-without-repeating-characters
0076-minimum-window-substring
0239-sliding-window-maximum
0424-longest-repeating-character-replacement
0567-permutation-in-string

Bit Manipulation

0090-subsets-ii
0136-single-number
0190-reverse-bits
0268-missing-number
0287-find-the-duplicate-number

Divide and Conquer

0004-median-of-two-sorted-arrays
0023-merge-k-sorted-lists
0190-reverse-bits
0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements

Math

0007-reverse-integer
0048-rotate-image
0050-powx-n
0066-plus-one
0070-climbing-stairs
0202-happy-number
0268-missing-number

Linked List

0019-remove-nth-node-from-end-of-list
0021-merge-two-sorted-lists
0023-merge-k-sorted-lists
0025-reverse-nodes-in-k-group
0138-copy-list-with-random-pointer
0141-linked-list-cycle
0143-reorder-list
0206-reverse-linked-list

Recursion

0021-merge-two-sorted-lists
0025-reverse-nodes-in-k-group
0050-powx-n
0143-reorder-list
0206-reverse-linked-list

Design

0297-serialize-and-deserialize-binary-tree
0789-kth-largest-element-in-a-stream
1023-time-based-key-value-store

Tree

0098-validate-binary-search-tree
0102-binary-tree-level-order-traversal
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0124-binary-tree-maximum-path-sum
0199-binary-tree-right-side-view
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0297-serialize-and-deserialize-binary-tree
0572-subtree-of-another-tree
0789-kth-largest-element-in-a-stream

Depth-First Search

0098-validate-binary-search-tree
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0124-binary-tree-maximum-path-sum
0199-binary-tree-right-side-view
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0297-serialize-and-deserialize-binary-tree
0572-subtree-of-another-tree

Breadth-First Search

0102-binary-tree-level-order-traversal
0104-maximum-depth-of-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0297-serialize-and-deserialize-binary-tree

Binary Tree

0098-validate-binary-search-tree
0102-binary-tree-level-order-traversal
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0124-binary-tree-maximum-path-sum
0199-binary-tree-right-side-view
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0297-serialize-and-deserialize-binary-tree
0572-subtree-of-another-tree
0789-kth-largest-element-in-a-stream

Memoization

0070-climbing-stairs

Heap (Priority Queue)

0023-merge-k-sorted-lists
0215-kth-largest-element-in-an-array
0239-sliding-window-maximum
0347-top-k-frequent-elements
0789-kth-largest-element-in-a-stream
1127-last-stone-weight

Merge Sort

0023-merge-k-sorted-lists

Queue

0239-sliding-window-maximum

Monotonic Queue

0239-sliding-window-maximum

String Matching

0020-valid-parentheses
0049-group-anagrams
0079-word-search
0242-valid-anagram
0297-serialize-and-deserialize-binary-tree
0572-subtree-of-another-tree
0678-valid-parenthesis-string
0768-partition-labels

Hash Function

0572-subtree-of-another-tree

Binary Search Tree

0098-validate-binary-search-tree
0167-two-sum-ii-input-array-is-sorted
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0789-kth-largest-element-in-a-stream

Backtracking

0039-combination-sum
0040-combination-sum-ii
0046-permutations
0079-word-search
0090-subsets-ii

Data Stream

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

Greedy

0055-jump-game
0678-valid-parenthesis-string
0768-partition-labels
2026-merge-triplets-to-form-target-triplet

Quickselect

0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements

Simulation

0054-spiral-matrix

Bucket Sort

0347-top-k-frequent-elements

Counting

0347-top-k-frequent-elements

Prefix Sum

0238-product-of-array-except-self

LeetCode Topics

Array

0015-3sum
0018-4sum
0026-remove-duplicates-from-sorted-array
0027-remove-element
0031-next-permutation
0033-search-in-rotated-sorted-array
0034-find-first-and-last-position-of-element-in-sorted-array
0035-search-insert-position
0039-combination-sum
0045-jump-game-ii
0046-permutations
0049-group-anagrams
0051-n-queens
0053-maximum-subarray
0055-jump-game
0056-merge-intervals
0057-insert-interval
0064-minimum-path-sum
0073-set-matrix-zeroes
0074-search-a-2d-matrix
0075-sort-colors
0078-subsets
0081-search-in-rotated-sorted-array-ii
0088-merge-sorted-array
0118-pascals-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
0134-gas-station
0136-single-number
0152-maximum-product-subarray
0153-find-minimum-in-rotated-sorted-array
0162-find-peak-element
0169-majority-element
0189-rotate-array
0198-house-robber
0200-number-of-islands
0204-count-primes
0215-kth-largest-element-in-an-array
0229-majority-element-ii
0238-product-of-array-except-self
0240-search-a-2d-matrix-ii
0268-missing-number
0283-move-zeroes
0287-find-the-duplicate-number
0300-longest-increasing-subsequence
0322-coin-change
0347-top-k-frequent-elements
0410-split-array-largest-sum
0416-partition-equal-subset-sum
0435-non-overlapping-intervals
0442-find-all-duplicates-in-an-array
0455-assign-cookies
0485-max-consecutive-ones
0493-reverse-pairs
0540-single-element-in-a-sorted-array
0560-subarray-sum-equals-k
0621-task-scheduler
0695-max-area-of-island
0714-best-time-to-buy-and-sell-stock-with-transaction-fee
0792-binary-search
0907-koko-eating-bananas
1014-k-closest-points-to-origin
1036-rotting-oranges
1046-max-consecutive-ones-iii
1056-capacity-to-ship-packages-within-d-days
1408-find-the-smallest-divisor-given-a-threshold
1605-minimum-number-of-days-to-make-m-bouquets
1646-kth-missing-positive-number
1878-check-if-array-is-sorted-and-rotated
1966-frequency-of-the-most-frequent-element
2026-merge-triplets-to-form-target-triplet
2271-rearrange-array-elements-by-sign

Hash Table

0003-longest-substring-without-repeating-characters
0013-roman-to-integer
0017-letter-combinations-of-a-phone-number
0049-group-anagrams
0073-set-matrix-zeroes
0128-longest-consecutive-sequence
0133-clone-graph
0141-linked-list-cycle
0142-linked-list-cycle-ii
0169-majority-element
0205-isomorphic-strings
0208-implement-trie-prefix-tree
0229-majority-element-ii
0242-valid-anagram
0268-missing-number
0347-top-k-frequent-elements
0355-design-twitter
0424-longest-repeating-character-replacement
0442-find-all-duplicates-in-an-array
0451-sort-characters-by-frequency
0560-subarray-sum-equals-k
0621-task-scheduler
1023-time-based-key-value-store
1890-sum-of-beauty-of-all-substrings

Matrix

0064-minimum-path-sum
0073-set-matrix-zeroes
0074-search-a-2d-matrix
0130-surrounded-regions
0200-number-of-islands
0240-search-a-2d-matrix-ii
0695-max-area-of-island
1036-rotting-oranges

Binary Search

0033-search-in-rotated-sorted-array
0034-find-first-and-last-position-of-element-in-sorted-array
0035-search-insert-position
0074-search-a-2d-matrix
0081-search-in-rotated-sorted-array-ii
0153-find-minimum-in-rotated-sorted-array
0162-find-peak-element
0240-search-a-2d-matrix-ii
0268-missing-number
0287-find-the-duplicate-number
0300-longest-increasing-subsequence
0410-split-array-largest-sum
0493-reverse-pairs
0540-single-element-in-a-sorted-array
0792-binary-search
0907-koko-eating-bananas
1023-time-based-key-value-store
1046-max-consecutive-ones-iii
1056-capacity-to-ship-packages-within-d-days
1408-find-the-smallest-divisor-given-a-threshold
1605-minimum-number-of-days-to-make-m-bouquets
1646-kth-missing-positive-number
1966-frequency-of-the-most-frequent-element

Dynamic Programming

0005-longest-palindromic-substring
0022-generate-parentheses
0032-longest-valid-parentheses
0045-jump-game-ii
0053-maximum-subarray
0055-jump-game
0062-unique-paths
0064-minimum-path-sum
0118-pascals-triangle
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0124-binary-tree-maximum-path-sum
0131-palindrome-partitioning
0152-maximum-product-subarray
0198-house-robber
0300-longest-increasing-subsequence
0322-coin-change
0410-split-array-largest-sum
0416-partition-equal-subset-sum
0435-non-overlapping-intervals
0647-palindromic-substrings
0714-best-time-to-buy-and-sell-stock-with-transaction-fee
1013-fibonacci-number
1250-longest-common-subsequence

String

0003-longest-substring-without-repeating-characters
0005-longest-palindromic-substring
0008-string-to-integer-atoi
0013-roman-to-integer
0014-longest-common-prefix
0017-letter-combinations-of-a-phone-number
0022-generate-parentheses
0028-find-the-index-of-the-first-occurrence-in-a-string
0032-longest-valid-parentheses
0049-group-anagrams
0125-valid-palindrome
0131-palindrome-partitioning
0151-reverse-words-in-a-string
0205-isomorphic-strings
0208-implement-trie-prefix-tree
0214-shortest-palindrome
0242-valid-anagram
0344-reverse-string
0424-longest-repeating-character-replacement
0451-sort-characters-by-frequency
0647-palindromic-substrings
0686-repeated-string-match
0812-rotate-string
1023-time-based-key-value-store
1078-remove-outermost-parentheses
1250-longest-common-subsequence
1737-maximum-nesting-depth-of-the-parentheses
1890-sum-of-beauty-of-all-substrings
2032-largest-odd-number-in-string

Design

0208-implement-trie-prefix-tree
0295-find-median-from-data-stream
0355-design-twitter
0789-kth-largest-element-in-a-stream
1023-time-based-key-value-store

Sliding Window

0003-longest-substring-without-repeating-characters
0424-longest-repeating-character-replacement
1046-max-consecutive-ones-iii
1966-frequency-of-the-most-frequent-element

Linked List

0002-add-two-numbers
0019-remove-nth-node-from-end-of-list
0021-merge-two-sorted-lists
0141-linked-list-cycle
0142-linked-list-cycle-ii
0143-reorder-list
0206-reverse-linked-list
0237-delete-node-in-a-linked-list
0328-odd-even-linked-list
0355-design-twitter
0908-middle-of-the-linked-list
2216-delete-the-middle-node-of-a-linked-list

Recursion

0002-add-two-numbers
0021-merge-two-sorted-lists
0050-powx-n
0143-reorder-list
0206-reverse-linked-list
0231-power-of-two
1013-fibonacci-number
2050-count-good-numbers

Two Pointers

0005-longest-palindromic-substring
0015-3sum
0018-4sum
0019-remove-nth-node-from-end-of-list
0026-remove-duplicates-from-sorted-array
0027-remove-element
0028-find-the-index-of-the-first-occurrence-in-a-string
0031-next-permutation
0075-sort-colors
0088-merge-sorted-array
0125-valid-palindrome
0141-linked-list-cycle
0142-linked-list-cycle-ii
0143-reorder-list
0151-reverse-words-in-a-string
0189-rotate-array
0283-move-zeroes
0287-find-the-duplicate-number
0295-find-median-from-data-stream
0344-reverse-string
0455-assign-cookies
0647-palindromic-substrings
0908-middle-of-the-linked-list
2216-delete-the-middle-node-of-a-linked-list
2271-rearrange-array-elements-by-sign

Stack

0032-longest-valid-parentheses
0094-binary-tree-inorder-traversal
0143-reorder-list
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
1078-remove-outermost-parentheses
1737-maximum-nesting-depth-of-the-parentheses

Bit Manipulation

0078-subsets
0136-single-number
0191-number-of-1-bits
0231-power-of-two
0268-missing-number
0287-find-the-duplicate-number
0371-sum-of-two-integers

Tree

0094-binary-tree-inorder-traversal
0100-same-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0124-binary-tree-maximum-path-sum
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
0235-lowest-common-ancestor-of-a-binary-search-tree
0789-kth-largest-element-in-a-stream

Depth-First Search

0094-binary-tree-inorder-traversal
0100-same-tree
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0124-binary-tree-maximum-path-sum
0130-surrounded-regions
0133-clone-graph
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
0200-number-of-islands
0207-course-schedule
0210-course-schedule-ii
0235-lowest-common-ancestor-of-a-binary-search-tree
0684-redundant-connection
0695-max-area-of-island

Breadth-First Search

0100-same-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0130-surrounded-regions
0133-clone-graph
0200-number-of-islands
0207-course-schedule
0210-course-schedule-ii
0322-coin-change
0684-redundant-connection
0695-max-area-of-island
1036-rotting-oranges

Binary Tree

0094-binary-tree-inorder-traversal
0100-same-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0124-binary-tree-maximum-path-sum
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
0235-lowest-common-ancestor-of-a-binary-search-tree
0789-kth-largest-element-in-a-stream

Trie

0014-longest-common-prefix
0208-implement-trie-prefix-tree

Union Find

0128-longest-consecutive-sequence
0130-surrounded-regions
0200-number-of-islands
0684-redundant-connection
0695-max-area-of-island

Binary Search Tree

0235-lowest-common-ancestor-of-a-binary-search-tree
0789-kth-largest-element-in-a-stream

Backtracking

0017-letter-combinations-of-a-phone-number
0022-generate-parentheses
0039-combination-sum
0046-permutations
0051-n-queens
0078-subsets
0131-palindrome-partitioning

Sorting

0015-3sum
0018-4sum
0049-group-anagrams
0056-merge-intervals
0075-sort-colors
0088-merge-sorted-array
0169-majority-element
0215-kth-largest-element-in-an-array
0229-majority-element-ii
0242-valid-anagram
0268-missing-number
0295-find-median-from-data-stream
0347-top-k-frequent-elements
0435-non-overlapping-intervals
0451-sort-characters-by-frequency
0455-assign-cookies
0621-task-scheduler
1014-k-closest-points-to-origin
1966-frequency-of-the-most-frequent-element

Divide and Conquer

0053-maximum-subarray
0169-majority-element
0191-number-of-1-bits
0215-kth-largest-element-in-an-array
0240-search-a-2d-matrix-ii
0347-top-k-frequent-elements
0493-reverse-pairs
1014-k-closest-points-to-origin

Heap (Priority Queue)

0215-kth-largest-element-in-an-array
0295-find-median-from-data-stream
0347-top-k-frequent-elements
0355-design-twitter
0451-sort-characters-by-frequency
0621-task-scheduler
0789-kth-largest-element-in-a-stream
1014-k-closest-points-to-origin

Bucket Sort

0347-top-k-frequent-elements
0451-sort-characters-by-frequency

Counting

0169-majority-element
0229-majority-element-ii
0347-top-k-frequent-elements
0451-sort-characters-by-frequency
0621-task-scheduler
1890-sum-of-beauty-of-all-substrings

Quickselect

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

Prefix Sum

0238-product-of-array-except-self
0410-split-array-largest-sum
0560-subarray-sum-equals-k
1046-max-consecutive-ones-iii
1966-frequency-of-the-most-frequent-element

Data Stream

0295-find-median-from-data-stream
0789-kth-largest-element-in-a-stream

Greedy

0045-jump-game-ii
0055-jump-game
0122-best-time-to-buy-and-sell-stock-ii
0134-gas-station
0410-split-array-largest-sum
0435-non-overlapping-intervals
0455-assign-cookies
0621-task-scheduler
0714-best-time-to-buy-and-sell-stock-with-transaction-fee
1966-frequency-of-the-most-frequent-element
2026-merge-triplets-to-form-target-triplet
2032-largest-odd-number-in-string

Math

0002-add-two-numbers
0007-reverse-integer
0009-palindrome-number
0013-roman-to-integer
0050-powx-n
0062-unique-paths
0189-rotate-array
0204-count-primes
0231-power-of-two
0268-missing-number
0371-sum-of-two-integers
1013-fibonacci-number
1014-k-closest-points-to-origin
2032-largest-odd-number-in-string
2050-count-good-numbers

Geometry

1014-k-closest-points-to-origin

Combinatorics

0062-unique-paths

Graph

0133-clone-graph
0207-course-schedule
0210-course-schedule-ii
0684-redundant-connection

Topological Sort

0207-course-schedule
0210-course-schedule-ii

Simulation

2271-rearrange-array-elements-by-sign

String Matching

0028-find-the-index-of-the-first-occurrence-in-a-string
0214-shortest-palindrome
0686-repeated-string-match
0812-rotate-string

Memoization

1013-fibonacci-number

Enumeration

0204-count-primes

Number Theory

0204-count-primes

Rolling Hash

0214-shortest-palindrome

Hash Function

0214-shortest-palindrome

Binary Indexed Tree

0493-reverse-pairs

Segment Tree

0493-reverse-pairs

Merge Sort

0493-reverse-pairs

Ordered Set

0493-reverse-pairs

Database

0197-rising-temperature
1153-product-sales-analysis-i

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