Skip to content

shivansh196/Data-Structure-and-Algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

LeetCode Topics

Tree

0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0108-convert-sorted-array-to-binary-search-tree
0112-path-sum
0144-binary-tree-preorder-traversal
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
0236-lowest-common-ancestor-of-a-binary-tree
0530-minimum-absolute-difference-in-bst
0543-diameter-of-binary-tree
0617-merge-two-binary-trees
0637-average-of-levels-in-binary-tree
0653-two-sum-iv-input-is-a-bst
0784-insert-into-a-binary-search-tree
0789-kth-largest-element-in-a-stream
1029-vertical-order-traversal-of-a-binary-tree
1114-binary-search-tree-to-greater-sum-tree
1498-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree
1544-count-good-nodes-in-binary-tree
2384-root-equals-sum-of-children
2416-evaluate-boolean-binary-tree

Depth-First Search

0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0104-maximum-depth-of-binary-tree
0112-path-sum
0130-surrounded-regions
0144-binary-tree-preorder-traversal
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
0236-lowest-common-ancestor-of-a-binary-tree
0530-minimum-absolute-difference-in-bst
0543-diameter-of-binary-tree
0547-number-of-provinces
0617-merge-two-binary-trees
0637-average-of-levels-in-binary-tree
0653-two-sum-iv-input-is-a-bst
0733-flood-fill
0813-all-paths-from-source-to-target
1029-vertical-order-traversal-of-a-binary-tree
1114-binary-search-tree-to-greater-sum-tree
1498-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree
1544-count-good-nodes-in-binary-tree
2416-evaluate-boolean-binary-tree

Breadth-First Search

0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0112-path-sum
0127-word-ladder
0130-surrounded-regions
0199-binary-tree-right-side-view
0226-invert-binary-tree
0322-coin-change
0530-minimum-absolute-difference-in-bst
0547-number-of-provinces
0617-merge-two-binary-trees
0637-average-of-levels-in-binary-tree
0653-two-sum-iv-input-is-a-bst
0733-flood-fill
0813-all-paths-from-source-to-target
1029-vertical-order-traversal-of-a-binary-tree
1036-rotting-oranges
1498-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree
1544-count-good-nodes-in-binary-tree

Binary Tree

0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0108-convert-sorted-array-to-binary-search-tree
0112-path-sum
0144-binary-tree-preorder-traversal
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
0236-lowest-common-ancestor-of-a-binary-tree
0530-minimum-absolute-difference-in-bst
0543-diameter-of-binary-tree
0617-merge-two-binary-trees
0637-average-of-levels-in-binary-tree
0653-two-sum-iv-input-is-a-bst
0784-insert-into-a-binary-search-tree
0789-kth-largest-element-in-a-stream
1029-vertical-order-traversal-of-a-binary-tree
1114-binary-search-tree-to-greater-sum-tree
1498-find-a-corresponding-node-of-a-binary-tree-in-a-clone-of-that-tree
1544-count-good-nodes-in-binary-tree
2384-root-equals-sum-of-children
2416-evaluate-boolean-binary-tree

Linked List

0002-add-two-numbers
0021-merge-two-sorted-lists
0082-remove-duplicates-from-sorted-list-ii
0083-remove-duplicates-from-sorted-list
0086-partition-list
0138-copy-list-with-random-pointer
0141-linked-list-cycle
0143-reorder-list
0148-sort-list
0203-remove-linked-list-elements
0206-reverse-linked-list
0234-palindrome-linked-list
0908-middle-of-the-linked-list
1411-convert-binary-number-in-a-linked-list-to-integer
2299-merge-nodes-in-between-zeros
2903-insert-greatest-common-divisors-in-linked-list

Math

0002-add-two-numbers
0007-reverse-integer
0009-palindrome-number
0048-rotate-image
0062-unique-paths
0067-add-binary
0069-sqrtx
0070-climbing-stairs
0168-excel-sheet-column-title
0172-factorial-trailing-zeroes
0202-happy-number
0204-count-primes
0268-missing-number
0371-sum-of-two-integers
0628-maximum-product-of-three-numbers
1014-k-closest-points-to-origin
1370-count-number-of-nice-subarrays
1411-convert-binary-number-in-a-linked-list-to-integer
1885-count-number-of-homogenous-substrings
2903-insert-greatest-common-divisors-in-linked-list

Two Pointers

0011-container-with-most-water
0015-3sum
0026-remove-duplicates-from-sorted-array
0042-trapping-rain-water
0075-sort-colors
0080-remove-duplicates-from-sorted-array-ii
0082-remove-duplicates-from-sorted-list-ii
0086-partition-list
0088-merge-sorted-array
0125-valid-palindrome
0141-linked-list-cycle
0143-reorder-list
0148-sort-list
0151-reverse-words-in-a-string
0167-two-sum-ii-input-array-is-sorted
0202-happy-number
0234-palindrome-linked-list
0283-move-zeroes
0287-find-the-duplicate-number
0532-k-diff-pairs-in-an-array
0567-permutation-in-string
0653-two-sum-iv-input-is-a-bst
0908-middle-of-the-linked-list
1615-range-sum-of-sorted-subarray-sums

String

0003-longest-substring-without-repeating-characters
0008-string-to-integer-atoi
0014-longest-common-prefix
0020-valid-parentheses
0049-group-anagrams
0058-length-of-last-word
0067-add-binary
0125-valid-palindrome
0127-word-ladder
0151-reverse-words-in-a-string
0168-excel-sheet-column-title
0205-isomorphic-strings
0424-longest-repeating-character-replacement
0567-permutation-in-string
0742-to-lower-case
0782-jewels-and-stones
1170-shortest-common-supersequence
1250-longest-common-subsequence
1807-partitioning-into-minimum-number-of-deci-binary-numbers
1885-count-number-of-homogenous-substrings
2163-kth-distinct-string-in-an-array
2219-maximum-number-of-words-found-in-sentences
2727-number-of-senior-citizens
2886-faulty-keyboard
3276-minimum-number-of-pushes-to-type-word-ii
3543-count-substrings-that-satisfy-k-constraint-i

Array

0001-two-sum
0011-container-with-most-water
0015-3sum
0026-remove-duplicates-from-sorted-array
0033-search-in-rotated-sorted-array
0042-trapping-rain-water
0045-jump-game-ii
0048-rotate-image
0049-group-anagrams
0053-maximum-subarray
0055-jump-game
0056-merge-intervals
0063-unique-paths-ii
0064-minimum-path-sum
0074-search-a-2d-matrix
0075-sort-colors
0080-remove-duplicates-from-sorted-array-ii
0081-search-in-rotated-sorted-array-ii
0088-merge-sorted-array
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0108-convert-sorted-array-to-binary-search-tree
0121-best-time-to-buy-and-sell-stock
0128-longest-consecutive-sequence
0130-surrounded-regions
0135-candy
0136-single-number
0153-find-minimum-in-rotated-sorted-array
0162-find-peak-element
0167-two-sum-ii-input-array-is-sorted
0169-majority-element
0198-house-robber
0204-count-primes
0213-house-robber-ii
0215-kth-largest-element-in-an-array
0217-contains-duplicate
0219-contains-duplicate-ii
0238-product-of-array-except-self
0240-search-a-2d-matrix-ii
0268-missing-number
0274-h-index
0283-move-zeroes
0287-find-the-duplicate-number
0300-longest-increasing-subsequence
0322-coin-change
0416-partition-equal-subset-sum
0442-find-all-duplicates-in-an-array
0493-reverse-pairs
0494-target-sum
0503-next-greater-element-ii
0518-coin-change-ii
0532-k-diff-pairs-in-an-array
0560-subarray-sum-equals-k
0621-task-scheduler
0624-maximum-distance-in-arrays
0628-maximum-product-of-three-numbers
0733-flood-fill
0747-min-cost-climbing-stairs
0792-binary-search
0876-hand-of-straights
0890-lemonade-change
0966-binary-subarrays-with-sum
1014-k-closest-points-to-origin
1036-rotting-oranges
1046-max-consecutive-ones-iii
1127-last-stone-weight
1137-height-checker
1370-count-number-of-nice-subarrays
1538-maximum-points-you-can-obtain-from-cards
1556-make-two-arrays-equal-by-reversing-subarrays
1615-range-sum-of-sorted-subarray-sums
1833-find-the-highest-altitude
1961-maximum-ice-cream-bars
2042-maximum-product-difference-between-two-pairs
2163-kth-distinct-string-in-an-array
2219-maximum-number-of-words-found-in-sentences
2714-left-and-right-sum-differences
2727-number-of-senior-citizens
3206-find-common-elements-between-two-arrays
3525-maximum-energy-boost-from-two-drinks

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0049-group-anagrams
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0127-word-ladder
0128-longest-consecutive-sequence
0138-copy-list-with-random-pointer
0141-linked-list-cycle
0169-majority-element
0202-happy-number
0205-isomorphic-strings
0217-contains-duplicate
0219-contains-duplicate-ii
0268-missing-number
0424-longest-repeating-character-replacement
0442-find-all-duplicates-in-an-array
0532-k-diff-pairs-in-an-array
0560-subarray-sum-equals-k
0567-permutation-in-string
0621-task-scheduler
0653-two-sum-iv-input-is-a-bst
0782-jewels-and-stones
0876-hand-of-straights
0966-binary-subarrays-with-sum
1029-vertical-order-traversal-of-a-binary-tree
1370-count-number-of-nice-subarrays
1556-make-two-arrays-equal-by-reversing-subarrays
2163-kth-distinct-string-in-an-array
3206-find-common-elements-between-two-arrays
3276-minimum-number-of-pushes-to-type-word-ii

Sorting

0015-3sum
0049-group-anagrams
0056-merge-intervals
0075-sort-colors
0088-merge-sorted-array
0148-sort-list
0169-majority-element
0215-kth-largest-element-in-an-array
0217-contains-duplicate
0268-missing-number
0274-h-index
0532-k-diff-pairs-in-an-array
0621-task-scheduler
0628-maximum-product-of-three-numbers
0876-hand-of-straights
1014-k-closest-points-to-origin
1029-vertical-order-traversal-of-a-binary-tree
1137-height-checker
1556-make-two-arrays-equal-by-reversing-subarrays
1615-range-sum-of-sorted-subarray-sums
1961-maximum-ice-cream-bars
2042-maximum-product-difference-between-two-pairs
3276-minimum-number-of-pushes-to-type-word-ii

Graph

0547-number-of-provinces
0813-all-paths-from-source-to-target
1916-find-center-of-star-graph

Counting Sort

0169-majority-element
0274-h-index
0621-task-scheduler
1137-height-checker
2163-kth-distinct-string-in-an-array
3276-minimum-number-of-pushes-to-type-word-ii

Binary Search

0033-search-in-rotated-sorted-array
0069-sqrtx
0074-search-a-2d-matrix
0081-search-in-rotated-sorted-array-ii
0153-find-minimum-in-rotated-sorted-array
0162-find-peak-element
0167-two-sum-ii-input-array-is-sorted
0240-search-a-2d-matrix-ii
0268-missing-number
0287-find-the-duplicate-number
0300-longest-increasing-subsequence
0493-reverse-pairs
0532-k-diff-pairs-in-an-array
0792-binary-search
1046-max-consecutive-ones-iii
1615-range-sum-of-sorted-subarray-sums

Trie

0014-longest-common-prefix

Greedy

0011-container-with-most-water
0045-jump-game-ii
0055-jump-game
0135-candy
0621-task-scheduler
0624-maximum-distance-in-arrays
0876-hand-of-straights
0890-lemonade-change
1807-partitioning-into-minimum-number-of-deci-binary-numbers
1961-maximum-ice-cream-bars
3276-minimum-number-of-pushes-to-type-word-ii

Dynamic Programming

0042-trapping-rain-water
0045-jump-game-ii
0053-maximum-subarray
0055-jump-game
0062-unique-paths
0063-unique-paths-ii
0064-minimum-path-sum
0070-climbing-stairs
0121-best-time-to-buy-and-sell-stock
0198-house-robber
0213-house-robber-ii
0300-longest-increasing-subsequence
0322-coin-change
0338-counting-bits
0416-partition-equal-subset-sum
0494-target-sum
0518-coin-change-ii
0747-min-cost-climbing-stairs
1170-shortest-common-supersequence
1250-longest-common-subsequence
3525-maximum-energy-boost-from-two-drinks

Combinatorics

0062-unique-paths

Matrix

0048-rotate-image
0063-unique-paths-ii
0064-minimum-path-sum
0074-search-a-2d-matrix
0130-surrounded-regions
0240-search-a-2d-matrix-ii
0733-flood-fill
1036-rotting-oranges

Stack

0020-valid-parentheses
0042-trapping-rain-water
0143-reorder-list
0144-binary-tree-preorder-traversal
0234-palindrome-linked-list
0503-next-greater-element-ii

Monotonic Stack

0042-trapping-rain-water
0503-next-greater-element-ii

Sliding Window

0003-longest-substring-without-repeating-characters
0219-contains-duplicate-ii
0424-longest-repeating-character-replacement
0567-permutation-in-string
0966-binary-subarrays-with-sum
1046-max-consecutive-ones-iii
1370-count-number-of-nice-subarrays
1538-maximum-points-you-can-obtain-from-cards
3543-count-substrings-that-satisfy-k-constraint-i

Union Find

0128-longest-consecutive-sequence
0130-surrounded-regions
0547-number-of-provinces

Simulation

0067-add-binary
2299-merge-nodes-in-between-zeros
2886-faulty-keyboard

Number Theory

0204-count-primes
2903-insert-greatest-common-divisors-in-linked-list

Database

0584-find-customer-referee
0595-big-countries
1153-product-sales-analysis-i
1258-article-views-i
1509-replace-employee-id-with-the-unique-identifier
1827-invalid-tweets
1892-find-total-time-spent-by-each-employee
1908-recyclable-and-low-fat-products
2495-number-of-unique-subjects-taught-by-each-teacher

Divide and Conquer

0053-maximum-subarray
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0108-convert-sorted-array-to-binary-search-tree
0148-sort-list
0169-majority-element
0191-number-of-1-bits
0215-kth-largest-element-in-an-array
0240-search-a-2d-matrix-ii
0493-reverse-pairs
1014-k-closest-points-to-origin

Binary Search Tree

0098-validate-binary-search-tree
0108-convert-sorted-array-to-binary-search-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0530-minimum-absolute-difference-in-bst
0653-two-sum-iv-input-is-a-bst
0784-insert-into-a-binary-search-tree
0789-kth-largest-element-in-a-stream
1114-binary-search-tree-to-greater-sum-tree

Prefix Sum

0238-product-of-array-except-self
0560-subarray-sum-equals-k
0966-binary-subarrays-with-sum
1046-max-consecutive-ones-iii
1538-maximum-points-you-can-obtain-from-cards
1833-find-the-highest-altitude
2714-left-and-right-sum-differences

Backtracking

0494-target-sum
0813-all-paths-from-source-to-target

Heap (Priority Queue)

0215-kth-largest-element-in-an-array
0621-task-scheduler
0789-kth-largest-element-in-a-stream
1014-k-closest-points-to-origin
1127-last-stone-weight

Quickselect

0215-kth-largest-element-in-an-array
1014-k-closest-points-to-origin

Bit Manipulation

0067-add-binary
0136-single-number
0191-number-of-1-bits
0268-missing-number
0287-find-the-duplicate-number
0338-counting-bits
0371-sum-of-two-integers

Enumeration

0204-count-primes

Recursion

0002-add-two-numbers
0021-merge-two-sorted-lists
0143-reorder-list
0203-remove-linked-list-elements
0206-reverse-linked-list
0234-palindrome-linked-list

Memoization

0070-climbing-stairs

Merge Sort

0148-sort-list
0493-reverse-pairs

Design

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

Data Stream

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

Geometry

1014-k-closest-points-to-origin

Binary Indexed Tree

0493-reverse-pairs

Segment Tree

0493-reverse-pairs

Ordered Set

0493-reverse-pairs

About

The most important concepts of data structure and algorithms with questions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published