Skip to content

ppm143/SDE-Problems-for-interview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

606 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

LeetCode Topics

Array

0011-container-with-most-water
0015-3sum
0033-search-in-rotated-sorted-array
0036-valid-sudoku
0039-combination-sum
0040-combination-sum-ii
0042-trapping-rain-water
0045-jump-game-ii
0046-permutations
0051-n-queens
0054-spiral-matrix
0055-jump-game
0056-merge-intervals
0057-insert-interval
0066-plus-one
0074-search-a-2d-matrix
0078-subsets
0079-word-search
0084-largest-rectangle-in-histogram
0090-subsets-ii
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0108-convert-sorted-array-to-binary-search-tree
0118-pascals-triangle
0128-longest-consecutive-sequence
0130-surrounded-regions
0134-gas-station
0139-word-break
0150-evaluate-reverse-polish-notation
0152-maximum-product-subarray
0153-find-minimum-in-rotated-sorted-array
0167-two-sum-ii-input-array-is-sorted
0198-house-robber
0200-number-of-islands
0212-word-search-ii
0213-house-robber-ii
0215-kth-largest-element-in-an-array
0219-contains-duplicate-ii
0238-product-of-array-except-self
0239-sliding-window-maximum
0268-missing-number
0300-longest-increasing-subsequence
0309-best-time-to-buy-and-sell-stock-with-cooldown
0322-coin-change
0329-longest-increasing-path-in-a-matrix
0347-top-k-frequent-elements
0416-partition-equal-subset-sum
0417-pacific-atlantic-water-flow
0435-non-overlapping-intervals
0448-find-all-numbers-disappeared-in-an-array
0494-target-sum
0498-diagonal-traverse
0518-coin-change-ii
0621-task-scheduler
0695-max-area-of-island
0739-daily-temperatures
0747-min-cost-climbing-stairs
0875-longest-mountain-in-array
0876-hand-of-straights
0883-car-fleet
0907-koko-eating-bananas
0940-fruit-into-baskets
1014-k-closest-points-to-origin
1036-rotting-oranges
1127-last-stone-weight
1395-minimum-time-visiting-all-points
1402-count-square-submatrices-with-all-ones
1482-how-many-numbers-are-smaller-than-the-current-number
1586-longest-subarray-of-1s-after-deleting-one-element
1628-count-submatrices-with-all-ones
1995-finding-pairs-with-a-certain-sum
2026-merge-triplets-to-form-target-triplet
2432-number-of-zero-filled-subarrays
2503-longest-subarray-with-maximum-bitwise-and
2689-rearranging-fruits
3251-maximum-area-of-longest-diagonal-rectangle
3461-find-the-minimum-area-to-cover-all-ones-i
3788-maximum-unique-subarray-sum-after-deletion

Hash Table

0003-longest-substring-without-repeating-characters
0017-letter-combinations-of-a-phone-number
0036-valid-sudoku
0076-minimum-window-substring
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0127-word-ladder
0128-longest-consecutive-sequence
0133-clone-graph
0138-copy-list-with-random-pointer
0139-word-break
0141-linked-list-cycle
0146-lru-cache
0202-happy-number
0208-implement-trie-prefix-tree
0219-contains-duplicate-ii
0242-valid-anagram
0268-missing-number
0347-top-k-frequent-elements
0355-design-twitter
0424-longest-repeating-character-replacement
0448-find-all-numbers-disappeared-in-an-array
0567-permutation-in-string
0621-task-scheduler
0876-hand-of-straights
0893-all-nodes-distance-k-in-binary-tree
0940-fruit-into-baskets
1482-how-many-numbers-are-smaller-than-the-current-number
1995-finding-pairs-with-a-certain-sum
2689-rearranging-fruits
3788-maximum-unique-subarray-sum-after-deletion

Sliding Window

0003-longest-substring-without-repeating-characters
0076-minimum-window-substring
0219-contains-duplicate-ii
0239-sliding-window-maximum
0424-longest-repeating-character-replacement
0567-permutation-in-string
0940-fruit-into-baskets
1586-longest-subarray-of-1s-after-deleting-one-element

Two Pointers

0005-longest-palindromic-substring
0011-container-with-most-water
0015-3sum
0019-remove-nth-node-from-end-of-list
0042-trapping-rain-water
0125-valid-palindrome
0141-linked-list-cycle
0143-reorder-list
0167-two-sum-ii-input-array-is-sorted
0202-happy-number
0295-find-median-from-data-stream
0567-permutation-in-string
0647-palindromic-substrings
0875-longest-mountain-in-array

Dynamic Programming

0005-longest-palindromic-substring
0022-generate-parentheses
0042-trapping-rain-water
0045-jump-game-ii
0055-jump-game
0062-unique-paths
0070-climbing-stairs
0072-edit-distance
0091-decode-ways
0097-interleaving-string
0115-distinct-subsequences
0118-pascals-triangle
0124-binary-tree-maximum-path-sum
0131-palindrome-partitioning
0139-word-break
0152-maximum-product-subarray
0198-house-robber
0213-house-robber-ii
0300-longest-increasing-subsequence
0309-best-time-to-buy-and-sell-stock-with-cooldown
0322-coin-change
0329-longest-increasing-path-in-a-matrix
0338-counting-bits
0416-partition-equal-subset-sum
0435-non-overlapping-intervals
0494-target-sum
0518-coin-change-ii
0647-palindromic-substrings
0678-valid-parenthesis-string
0747-min-cost-climbing-stairs
0875-longest-mountain-in-array
1250-longest-common-subsequence
1402-count-square-submatrices-with-all-ones
1586-longest-subarray-of-1s-after-deleting-one-element
1628-count-submatrices-with-all-ones

Stack

0020-valid-parentheses
0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0143-reorder-list
0150-evaluate-reverse-polish-notation
0155-min-stack
0678-valid-parenthesis-string
0739-daily-temperatures
0883-car-fleet
1628-count-submatrices-with-all-ones
1818-maximum-score-from-removing-substrings

Monotonic Stack

0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0739-daily-temperatures
0883-car-fleet
1628-count-submatrices-with-all-ones

Greedy

0011-container-with-most-water
0045-jump-game-ii
0055-jump-game
0134-gas-station
0435-non-overlapping-intervals
0621-task-scheduler
0678-valid-parenthesis-string
0876-hand-of-straights
1818-maximum-score-from-removing-substrings
2026-merge-triplets-to-form-target-triplet
2689-rearranging-fruits
3788-maximum-unique-subarray-sum-after-deletion

Sorting

0015-3sum
0056-merge-intervals
0215-kth-largest-element-in-an-array
0242-valid-anagram
0268-missing-number
0295-find-median-from-data-stream
0347-top-k-frequent-elements
0435-non-overlapping-intervals
0621-task-scheduler
0876-hand-of-straights
0883-car-fleet
1014-k-closest-points-to-origin
1482-how-many-numbers-are-smaller-than-the-current-number
2689-rearranging-fruits

Divide and Conquer

0023-merge-k-sorted-lists
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0108-convert-sorted-array-to-binary-search-tree
0190-reverse-bits
0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
1014-k-closest-points-to-origin

Heap (Priority Queue)

0023-merge-k-sorted-lists
0215-kth-largest-element-in-an-array
0239-sliding-window-maximum
0295-find-median-from-data-stream
0347-top-k-frequent-elements
0355-design-twitter
0621-task-scheduler
0789-kth-largest-element-in-a-stream
1014-k-closest-points-to-origin
1127-last-stone-weight

Bucket Sort

0347-top-k-frequent-elements

Counting

0347-top-k-frequent-elements
0621-task-scheduler

Quickselect

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

Depth-First Search

0079-word-search
0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0117-populating-next-right-pointers-in-each-node-ii
0124-binary-tree-maximum-path-sum
0130-surrounded-regions
0133-clone-graph
0199-binary-tree-right-side-view
0200-number-of-islands
0207-course-schedule
0210-course-schedule-ii
0211-design-add-and-search-words-data-structure
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0297-serialize-and-deserialize-binary-tree
0329-longest-increasing-path-in-a-matrix
0417-pacific-atlantic-water-flow
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0623-add-one-row-to-tree
0637-average-of-levels-in-binary-tree
0684-redundant-connection
0695-max-area-of-island
0774-maximum-depth-of-n-ary-tree
0893-all-nodes-distance-k-in-binary-tree
1544-count-good-nodes-in-binary-tree
2347-count-nodes-equal-to-average-of-subtree
2493-reverse-odd-levels-of-binary-tree

Breadth-First Search

0100-same-tree
0101-symmetric-tree
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0107-binary-tree-level-order-traversal-ii
0117-populating-next-right-pointers-in-each-node-ii
0127-word-ladder
0130-surrounded-regions
0133-clone-graph
0199-binary-tree-right-side-view
0200-number-of-islands
0207-course-schedule
0210-course-schedule-ii
0226-invert-binary-tree
0297-serialize-and-deserialize-binary-tree
0322-coin-change
0329-longest-increasing-path-in-a-matrix
0417-pacific-atlantic-water-flow
0623-add-one-row-to-tree
0637-average-of-levels-in-binary-tree
0684-redundant-connection
0695-max-area-of-island
0774-maximum-depth-of-n-ary-tree
0893-all-nodes-distance-k-in-binary-tree
1036-rotting-oranges
1544-count-good-nodes-in-binary-tree
2493-reverse-odd-levels-of-binary-tree
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level

Union Find

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

Matrix

0036-valid-sudoku
0054-spiral-matrix
0074-search-a-2d-matrix
0079-word-search
0130-surrounded-regions
0200-number-of-islands
0212-word-search-ii
0329-longest-increasing-path-in-a-matrix
0417-pacific-atlantic-water-flow
0498-diagonal-traverse
0695-max-area-of-island
1036-rotting-oranges
1402-count-square-submatrices-with-all-ones
1628-count-submatrices-with-all-ones
3461-find-the-minimum-area-to-cover-all-ones-i

Simulation

0054-spiral-matrix
0498-diagonal-traverse

Linked List

0002-add-two-numbers
0019-remove-nth-node-from-end-of-list
0021-merge-two-sorted-lists
0023-merge-k-sorted-lists
0117-populating-next-right-pointers-in-each-node-ii
0138-copy-list-with-random-pointer
0141-linked-list-cycle
0143-reorder-list
0146-lru-cache
0206-reverse-linked-list
0355-design-twitter

Design

0146-lru-cache
0155-min-stack
0208-implement-trie-prefix-tree
0211-design-add-and-search-words-data-structure
0295-find-median-from-data-stream
0297-serialize-and-deserialize-binary-tree
0355-design-twitter
0789-kth-largest-element-in-a-stream
1995-finding-pairs-with-a-certain-sum

String

0003-longest-substring-without-repeating-characters
0005-longest-palindromic-substring
0017-letter-combinations-of-a-phone-number
0020-valid-parentheses
0022-generate-parentheses
0072-edit-distance
0076-minimum-window-substring
0079-word-search
0091-decode-ways
0097-interleaving-string
0115-distinct-subsequences
0125-valid-palindrome
0127-word-ladder
0131-palindrome-partitioning
0139-word-break
0208-implement-trie-prefix-tree
0211-design-add-and-search-words-data-structure
0212-word-search-ii
0242-valid-anagram
0297-serialize-and-deserialize-binary-tree
0424-longest-repeating-character-replacement
0567-permutation-in-string
0647-palindromic-substrings
0678-valid-parenthesis-string
1250-longest-common-subsequence
1818-maximum-score-from-removing-substrings
3396-valid-word

Data Stream

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

Math

0002-add-two-numbers
0062-unique-paths
0066-plus-one
0070-climbing-stairs
0150-evaluate-reverse-polish-notation
0202-happy-number
0231-power-of-two
0268-missing-number
1014-k-closest-points-to-origin
1395-minimum-time-visiting-all-points
2432-number-of-zero-filled-subarrays

Geometry

1014-k-closest-points-to-origin
1395-minimum-time-visiting-all-points

Tree

0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0107-binary-tree-level-order-traversal-ii
0108-convert-sorted-array-to-binary-search-tree
0110-balanced-binary-tree
0117-populating-next-right-pointers-in-each-node-ii
0124-binary-tree-maximum-path-sum
0199-binary-tree-right-side-view
0222-count-complete-tree-nodes
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0297-serialize-and-deserialize-binary-tree
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0623-add-one-row-to-tree
0637-average-of-levels-in-binary-tree
0774-maximum-depth-of-n-ary-tree
0789-kth-largest-element-in-a-stream
0893-all-nodes-distance-k-in-binary-tree
1544-count-good-nodes-in-binary-tree
2347-count-nodes-equal-to-average-of-subtree
2493-reverse-odd-levels-of-binary-tree
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level

Binary Search Tree

0033-search-in-rotated-sorted-array
0074-search-a-2d-matrix
0098-validate-binary-search-tree
0108-convert-sorted-array-to-binary-search-tree
0153-find-minimum-in-rotated-sorted-array
0167-two-sum-ii-input-array-is-sorted
0222-count-complete-tree-nodes
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0268-missing-number
0300-longest-increasing-subsequence
0789-kth-largest-element-in-a-stream
0907-koko-eating-bananas

Binary Tree

0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0107-binary-tree-level-order-traversal-ii
0108-convert-sorted-array-to-binary-search-tree
0110-balanced-binary-tree
0117-populating-next-right-pointers-in-each-node-ii
0124-binary-tree-maximum-path-sum
0199-binary-tree-right-side-view
0222-count-complete-tree-nodes
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0297-serialize-and-deserialize-binary-tree
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0623-add-one-row-to-tree
0637-average-of-levels-in-binary-tree
0789-kth-largest-element-in-a-stream
0893-all-nodes-distance-k-in-binary-tree
1544-count-good-nodes-in-binary-tree
2347-count-nodes-equal-to-average-of-subtree
2493-reverse-odd-levels-of-binary-tree
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level

String Matching

0572-subtree-of-another-tree

Hash Function

0572-subtree-of-another-tree

Bit Manipulation

0078-subsets
0090-subsets-ii
0190-reverse-bits
0222-count-complete-tree-nodes
0231-power-of-two
0268-missing-number
0338-counting-bits
2503-longest-subarray-with-maximum-bitwise-and

Queue

0239-sliding-window-maximum

Monotonic Queue

0239-sliding-window-maximum

Backtracking

0017-letter-combinations-of-a-phone-number
0022-generate-parentheses
0039-combination-sum
0040-combination-sum-ii
0046-permutations
0051-n-queens
0078-subsets
0079-word-search
0090-subsets-ii
0131-palindrome-partitioning
0212-word-search-ii
0494-target-sum

Graph

0133-clone-graph
0207-course-schedule
0210-course-schedule-ii
0329-longest-increasing-path-in-a-matrix
0684-redundant-connection

Enumeration

0875-longest-mountain-in-array

Prefix Sum

0238-product-of-array-except-self

Counting Sort

1482-how-many-numbers-are-smaller-than-the-current-number

Brainteaser

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

Topological Sort

0207-course-schedule
0210-course-schedule-ii
0329-longest-increasing-path-in-a-matrix

Memoization

0070-climbing-stairs
0139-word-break
0329-longest-increasing-path-in-a-matrix

Trie

0139-word-break
0208-implement-trie-prefix-tree
0211-design-add-and-search-words-data-structure
0212-word-search-ii

Recursion

0002-add-two-numbers
0021-merge-two-sorted-lists
0143-reorder-list
0206-reverse-linked-list
0231-power-of-two

Combinatorics

0062-unique-paths

Doubly-Linked List

0146-lru-cache

Merge Sort

0023-merge-k-sorted-lists

About

DSA problems for interview preparations in C++.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages