Skip to content

vatsal30/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,000 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode

This repo contains all the problems I pricticed from the leetcode for the interview preparations conatins most of problems from the https://neetcode.io/roadmap, https://takeuforward.org/interviews/strivers-sde-sheet-top-coding-interview-problems/ and Blind-75.

This repo has been updated using chrome extension LeetHub-2.0 and LeetHub to auto commit the problems once I solved them on leetcode.

LeetCode Topics

Stack

0020-valid-parentheses
0042-trapping-rain-water
0071-simplify-path
0084-largest-rectangle-in-histogram
0085-maximal-rectangle
0114-flatten-binary-tree-to-linked-list
0143-reorder-list
0145-binary-tree-postorder-traversal
0150-evaluate-reverse-polish-notation
0155-min-stack
0234-palindrome-linked-list
0394-decode-string
0678-valid-parenthesis-string
0735-asteroid-collision
0739-daily-temperatures
0780-max-chunks-to-make-sorted
0853-car-fleet
0901-online-stock-span
1371-minimum-remove-to-make-valid-parentheses
1570-final-prices-with-a-special-discount-in-a-shop
2021-remove-all-occurrences-of-a-substring
2221-check-if-a-parentheses-string-can-be-valid
2456-construct-smallest-number-from-di-string
3181-find-building-where-alice-and-bob-can-meet

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
0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed
0703-kth-largest-element-in-a-stream
0901-online-stock-span
0981-time-based-key-value-store
1387-find-elements-in-a-contaminated-binary-tree
1477-product-of-the-last-k-numbers
2429-design-a-food-rating-system
2434-design-a-number-container-system
3678-design-task-manager

Array

0001-two-sum
0004-median-of-two-sorted-arrays
0011-container-with-most-water
0015-3sum
0018-4sum
0027-remove-element
0033-search-in-rotated-sorted-array
0036-valid-sudoku
0042-trapping-rain-water
0047-permutations-ii
0049-group-anagrams
0063-unique-paths-ii
0064-minimum-path-sum
0066-plus-one
0074-search-a-2d-matrix
0084-largest-rectangle-in-histogram
0085-maximal-rectangle
0088-merge-sorted-array
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0118-pascals-triangle
0119-pascals-triangle-ii
0121-best-time-to-buy-and-sell-stock
0128-longest-consecutive-sequence
0136-single-number
0139-word-break
0150-evaluate-reverse-polish-notation
0153-find-minimum-in-rotated-sorted-array
0167-two-sum-ii-input-array-is-sorted
0198-house-robber
0212-word-search-ii
0213-house-robber-ii
0215-kth-largest-element-in-an-array
0217-contains-duplicate
0238-product-of-array-except-self
0239-sliding-window-maximum
0268-missing-number
0283-move-zeroes
0287-find-the-duplicate-number
0347-top-k-frequent-elements
0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed
0407-trapping-rain-water-ii
0448-find-all-numbers-disappeared-in-an-array
0485-max-consecutive-ones
0494-target-sum
0542-01-matrix
0621-task-scheduler
0645-set-mismatch
0689-maximum-sum-of-3-non-overlapping-subarrays
0704-binary-search
0735-asteroid-collision
0739-daily-temperatures
0780-max-chunks-to-make-sorted
0853-car-fleet
0854-making-a-large-island
0875-koko-eating-bananas
0904-fruit-into-baskets
0973-k-closest-points-to-origin
1004-max-consecutive-ones-iii
1025-minimum-cost-for-tickets
1046-last-stone-weight
1063-best-sightseeing-pair
1200-minimum-absolute-difference
1217-relative-sort-array
1364-tuple-with-same-product
1365-how-many-numbers-are-smaller-than-the-current-number
1396-count-servers-that-communicate
1470-shuffle-the-array
1477-product-of-the-last-k-numbers
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
1524-string-matching-in-an-array
1570-final-prices-with-a-special-discount-in-a-shop
1631-number-of-sub-arrays-with-odd-sum
1744-number-of-ways-to-form-a-target-string-given-a-dictionary
1819-construct-the-lexicographically-largest-valid-sequence
1876-map-of-highest-peak
1878-check-if-array-is-sorted-and-rotated
1895-minimum-number-of-operations-to-move-all-balls-to-each-box
1925-count-nice-pairs-in-an-array
1927-maximum-ascending-subarray-sum
1929-concatenation-of-array
2107-find-unique-binary-string
2145-grid-game
2196-create-binary-tree-from-descriptions
2292-counting-words-with-a-given-prefix
2358-number-of-ways-to-split-array
2392-successful-pairs-of-spells-and-potions
2448-count-number-of-bad-pairs
2465-shifting-letters-ii
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2533-bitwise-xor-of-all-pairings
2564-most-profitable-path-in-a-tree
2574-left-and-right-sum-differences
2586-longest-square-streak-in-an-array
2665-minimum-time-to-repair-cars
2685-first-completely-painted-row-or-column
2764-maximum-number-of-fish-in-a-grid
2766-find-the-prefix-common-array-of-two-arrays
2791-find-the-losers-of-the-circular-game
2792-neighboring-bitwise-xor
3181-find-building-where-alice-and-bob-can-meet
3219-make-lexicographically-smallest-array-by-swapping-elements
3309-count-prefix-and-suffix-pairs-i
3332-minimum-operations-to-exceed-threshold-value-ii
3372-longest-strictly-increasing-or-strictly-decreasing-subarray
3429-special-array-i
3434-find-the-number-of-distinct-colors-among-the-balls
3621-minimum-operations-to-make-array-values-equal-to-k
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii

Math

0002-add-two-numbers
0062-unique-paths
0066-plus-one
0070-climbing-stairs
0150-evaluate-reverse-polish-notation
0268-missing-number
0371-sum-of-two-integers
0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed
0973-k-closest-points-to-origin
1146-greatest-common-divisor-of-strings
1477-product-of-the-last-k-numbers
1631-number-of-sub-arrays-with-odd-sum
1642-water-bottles
1925-count-nice-pairs-in-an-array
2448-count-number-of-bad-pairs
2802-find-the-punishment-number-of-an-integer
2812-find-the-maximum-achievable-number

Monotonic Stack

0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0085-maximal-rectangle
0739-daily-temperatures
0780-max-chunks-to-make-sorted
0853-car-fleet
0901-online-stock-span
1570-final-prices-with-a-special-discount-in-a-shop
3181-find-building-where-alice-and-bob-can-meet

Greedy

0011-container-with-most-water
0621-task-scheduler
0678-valid-parenthesis-string
0780-max-chunks-to-make-sorted
1502-construct-k-palindrome-strings
2221-check-if-a-parentheses-string-can-be-valid
2456-construct-smallest-number-from-di-string
2509-minimize-xor

Sorting

0015-3sum
0018-4sum
0047-permutations-ii
0049-group-anagrams
0088-merge-sorted-array
0215-kth-largest-element-in-an-array
0217-contains-duplicate
0242-valid-anagram
0268-missing-number
0295-find-median-from-data-stream
0347-top-k-frequent-elements
0389-find-the-difference
0621-task-scheduler
0645-set-mismatch
0780-max-chunks-to-make-sorted
0853-car-fleet
0973-k-closest-points-to-origin
1200-minimum-absolute-difference
1217-relative-sort-array
1365-how-many-numbers-are-smaller-than-the-current-number
2392-successful-pairs-of-spells-and-potions
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2586-longest-square-streak-in-an-array
3219-make-lexicographically-smallest-array-by-swapping-elements

Tree

0098-validate-binary-search-tree
0099-recover-binary-search-tree
0100-same-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
0110-balanced-binary-tree
0112-path-sum
0113-path-sum-ii
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0124-binary-tree-maximum-path-sum
0145-binary-tree-postorder-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
0297-serialize-and-deserialize-binary-tree
0337-house-robber-iii
0404-sum-of-left-leaves
0450-delete-node-in-a-bst
0515-find-largest-value-in-each-tree-row
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0653-two-sum-iv-input-is-a-bst
0703-kth-largest-element-in-a-stream
1093-recover-a-tree-from-preorder-traversal
1387-find-elements-in-a-contaminated-binary-tree
1448-count-good-nodes-in-binary-tree
2196-create-binary-tree-from-descriptions
2493-reverse-odd-levels-of-binary-tree
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2564-most-profitable-path-in-a-tree
3058-maximum-number-of-k-divisible-components
3439-find-minimum-diameter-after-merging-two-trees

Depth-First Search

0098-validate-binary-search-tree
0099-recover-binary-search-tree
0100-same-tree
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0112-path-sum
0113-path-sum-ii
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0124-binary-tree-maximum-path-sum
0145-binary-tree-postorder-traversal
0199-binary-tree-right-side-view
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
0297-serialize-and-deserialize-binary-tree
0337-house-robber-iii
0404-sum-of-left-leaves
0430-flatten-a-multilevel-doubly-linked-list
0515-find-largest-value-in-each-tree-row
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0653-two-sum-iv-input-is-a-bst
0684-redundant-connection
0801-is-graph-bipartite
0820-find-eventual-safe-states
0854-making-a-large-island
1093-recover-a-tree-from-preorder-traversal
1387-find-elements-in-a-contaminated-binary-tree
1396-count-servers-that-communicate
1448-count-good-nodes-in-binary-tree
1558-course-schedule-iv
2246-maximum-employees-to-be-invited-to-a-meeting
2493-reverse-odd-levels-of-binary-tree
2564-most-profitable-path-in-a-tree
2764-maximum-number-of-fish-in-a-grid
3058-maximum-number-of-k-divisible-components
3439-find-minimum-diameter-after-merging-two-trees

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
0112-path-sum
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0199-binary-tree-right-side-view
0207-course-schedule
0210-course-schedule-ii
0226-invert-binary-tree
0297-serialize-and-deserialize-binary-tree
0404-sum-of-left-leaves
0407-trapping-rain-water-ii
0515-find-largest-value-in-each-tree-row
0542-01-matrix
0653-two-sum-iv-input-is-a-bst
0684-redundant-connection
0801-is-graph-bipartite
0820-find-eventual-safe-states
0854-making-a-large-island
1387-find-elements-in-a-contaminated-binary-tree
1396-count-servers-that-communicate
1448-count-good-nodes-in-binary-tree
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
1558-course-schedule-iv
1876-map-of-highest-peak
2493-reverse-odd-levels-of-binary-tree
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level
2564-most-profitable-path-in-a-tree
2583-divide-nodes-into-the-maximum-number-of-groups
2764-maximum-number-of-fish-in-a-grid
3439-find-minimum-diameter-after-merging-two-trees

Binary Tree

0098-validate-binary-search-tree
0099-recover-binary-search-tree
0100-same-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
0110-balanced-binary-tree
0112-path-sum
0113-path-sum-ii
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0124-binary-tree-maximum-path-sum
0145-binary-tree-postorder-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
0297-serialize-and-deserialize-binary-tree
0337-house-robber-iii
0404-sum-of-left-leaves
0450-delete-node-in-a-bst
0515-find-largest-value-in-each-tree-row
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0653-two-sum-iv-input-is-a-bst
0703-kth-largest-element-in-a-stream
1093-recover-a-tree-from-preorder-traversal
1387-find-elements-in-a-contaminated-binary-tree
1448-count-good-nodes-in-binary-tree
2196-create-binary-tree-from-descriptions
2493-reverse-odd-levels-of-binary-tree
2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level

Two Pointers

0011-container-with-most-water
0015-3sum
0018-4sum
0019-remove-nth-node-from-end-of-list
0027-remove-element
0028-find-the-index-of-the-first-occurrence-in-a-string
0042-trapping-rain-water
0088-merge-sorted-array
0125-valid-palindrome
0141-linked-list-cycle
0143-reorder-list
0167-two-sum-ii-input-array-is-sorted
0234-palindrome-linked-list
0283-move-zeroes
0287-find-the-duplicate-number
0295-find-median-from-data-stream
0567-permutation-in-string
0653-two-sum-iv-input-is-a-bst
0876-middle-of-the-linked-list
1894-merge-strings-alternately
2392-successful-pairs-of-spells-and-potions

String

0003-longest-substring-without-repeating-characters
0020-valid-parentheses
0022-generate-parentheses
0028-find-the-index-of-the-first-occurrence-in-a-string
0049-group-anagrams
0071-simplify-path
0076-minimum-window-substring
0125-valid-palindrome
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
0389-find-the-difference
0394-decode-string
0424-longest-repeating-character-replacement
0459-repeated-substring-pattern
0567-permutation-in-string
0678-valid-parenthesis-string
0981-time-based-key-value-store
1093-recover-a-tree-from-preorder-traversal
1146-greatest-common-divisor-of-strings
1160-letter-tile-possibilities
1371-minimum-remove-to-make-valid-parentheses
1469-minimum-number-of-steps-to-make-two-strings-anagram
1502-construct-k-palindrome-strings
1516-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
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
1894-merge-strings-alternately
1895-minimum-number-of-operations-to-move-all-balls-to-each-box
1915-check-if-one-string-swap-can-make-strings-equal
2021-remove-all-occurrences-of-a-substring
2059-unique-length-3-palindromic-subsequences
2107-find-unique-binary-string
2221-check-if-a-parentheses-string-can-be-valid
2292-counting-words-with-a-given-prefix
2456-construct-smallest-number-from-di-string
2465-shifting-letters-ii
3309-count-prefix-and-suffix-pairs-i
3455-minimum-length-of-string-after-operations

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0036-valid-sudoku
0049-group-anagrams
0076-minimum-window-substring
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0128-longest-consecutive-sequence
0138-copy-list-with-random-pointer
0139-word-break
0141-linked-list-cycle
0146-lru-cache
0208-implement-trie-prefix-tree
0217-contains-duplicate
0242-valid-anagram
0268-missing-number
0347-top-k-frequent-elements
0355-design-twitter
0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed
0389-find-the-difference
0424-longest-repeating-character-replacement
0448-find-all-numbers-disappeared-in-an-array
0567-permutation-in-string
0621-task-scheduler
0645-set-mismatch
0653-two-sum-iv-input-is-a-bst
0904-fruit-into-baskets
0981-time-based-key-value-store
1160-letter-tile-possibilities
1217-relative-sort-array
1364-tuple-with-same-product
1365-how-many-numbers-are-smaller-than-the-current-number
1387-find-elements-in-a-contaminated-binary-tree
1469-minimum-number-of-steps-to-make-two-strings-anagram
1502-construct-k-palindrome-strings
1915-check-if-one-string-swap-can-make-strings-equal
1925-count-nice-pairs-in-an-array
2059-unique-length-3-palindromic-subsequences
2107-find-unique-binary-string
2196-create-binary-tree-from-descriptions
2429-design-a-food-rating-system
2434-design-a-number-container-system
2448-count-number-of-bad-pairs
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2586-longest-square-streak-in-an-array
2685-first-completely-painted-row-or-column
2766-find-the-prefix-common-array-of-two-arrays
2791-find-the-losers-of-the-circular-game
3434-find-the-number-of-distinct-colors-among-the-balls
3455-minimum-length-of-string-after-operations
3621-minimum-operations-to-make-array-values-equal-to-k
3678-design-task-manager

Bit Manipulation

0136-single-number
0190-reverse-bits
0191-number-of-1-bits
0268-missing-number
0287-find-the-duplicate-number
0338-counting-bits
0371-sum-of-two-integers
0389-find-the-difference
0645-set-mismatch
2059-unique-length-3-palindromic-subsequences
2509-minimize-xor
2533-bitwise-xor-of-all-pairings
2766-find-the-prefix-common-array-of-two-arrays
2792-neighboring-bitwise-xor

String Matching

0028-find-the-index-of-the-first-occurrence-in-a-string
0459-repeated-substring-pattern
0572-subtree-of-another-tree
1524-string-matching-in-an-array
2292-counting-words-with-a-given-prefix
3309-count-prefix-and-suffix-pairs-i

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
0167-two-sum-ii-input-array-is-sorted
0268-missing-number
0287-find-the-duplicate-number
0704-binary-search
0875-koko-eating-bananas
0981-time-based-key-value-store
1004-max-consecutive-ones-iii
2392-successful-pairs-of-spells-and-potions
2586-longest-square-streak-in-an-array
2665-minimum-time-to-repair-cars
3181-find-building-where-alice-and-bob-can-meet

Binary Indexed Tree

3181-find-building-where-alice-and-bob-can-meet

Segment Tree

3181-find-building-where-alice-and-bob-can-meet

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
0407-trapping-rain-water-ii
0621-task-scheduler
0703-kth-largest-element-in-a-stream
0973-k-closest-points-to-origin
1046-last-stone-weight
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
2429-design-a-food-rating-system
2434-design-a-number-container-system
2473-max-sum-of-a-pair-with-equal-sum-of-digits
3181-find-building-where-alice-and-bob-can-meet
3332-minimum-operations-to-exceed-threshold-value-ii
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii
3678-design-task-manager

Graph

0207-course-schedule
0210-course-schedule-ii
0684-redundant-connection
0801-is-graph-bipartite
0820-find-eventual-safe-states
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
1558-course-schedule-iv
2246-maximum-employees-to-be-invited-to-a-meeting
2564-most-profitable-path-in-a-tree
2583-divide-nodes-into-the-maximum-number-of-groups
3439-find-minimum-diameter-after-merging-two-trees
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii

Dynamic Programming

0022-generate-parentheses
0042-trapping-rain-water
0062-unique-paths
0063-unique-paths-ii
0064-minimum-path-sum
0070-climbing-stairs
0085-maximal-rectangle
0118-pascals-triangle
0119-pascals-triangle-ii
0121-best-time-to-buy-and-sell-stock
0124-binary-tree-maximum-path-sum
0139-word-break
0198-house-robber
0213-house-robber-ii
0337-house-robber-iii
0338-counting-bits
0494-target-sum
0542-01-matrix
0678-valid-parenthesis-string
0689-maximum-sum-of-3-non-overlapping-subarrays
1025-minimum-cost-for-tickets
1063-best-sightseeing-pair
1263-number-of-dice-rolls-with-target-sum
1631-number-of-sub-arrays-with-odd-sum
1744-number-of-ways-to-form-a-target-string-given-a-dictionary
2562-count-ways-to-build-good-strings
2586-longest-square-streak-in-an-array

Backtracking

0022-generate-parentheses
0047-permutations-ii
0113-path-sum-ii
0212-word-search-ii
0494-target-sum
1160-letter-tile-possibilities
1516-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
1819-construct-the-lexicographically-largest-valid-sequence
2107-find-unique-binary-string
2456-construct-smallest-number-from-di-string
2802-find-the-punishment-number-of-an-integer

Memoization

0070-climbing-stairs
0139-word-break

Prefix Sum

0238-product-of-array-except-self
1004-max-consecutive-ones-iii
1477-product-of-the-last-k-numbers
1537-maximum-score-after-splitting-a-string
1631-number-of-sub-arrays-with-odd-sum
1895-minimum-number-of-operations-to-move-all-balls-to-each-box
2059-unique-length-3-palindromic-subsequences
2145-grid-game
2358-number-of-ways-to-split-array
2465-shifting-letters-ii
2574-left-and-right-sum-differences

Ordered Set

2429-design-a-food-rating-system
2434-design-a-number-container-system
3678-design-task-manager

Combinatorics

0062-unique-paths

Linked List

0002-add-two-numbers
0019-remove-nth-node-from-end-of-list
0021-merge-two-sorted-lists
0023-merge-k-sorted-lists
0025-reverse-nodes-in-k-group
0092-reverse-linked-list-ii
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
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
0234-palindrome-linked-list
0328-odd-even-linked-list
0355-design-twitter
0430-flatten-a-multilevel-doubly-linked-list
0876-middle-of-the-linked-list

Recursion

0002-add-two-numbers
0021-merge-two-sorted-lists
0025-reverse-nodes-in-k-group
0143-reorder-list
0206-reverse-linked-list
0234-palindrome-linked-list
0394-decode-string

Trie

0139-word-break
0208-implement-trie-prefix-tree
0211-design-add-and-search-words-data-structure
0212-word-search-ii
3309-count-prefix-and-suffix-pairs-i

Rolling Hash

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

Hash Function

0572-subtree-of-another-tree
3309-count-prefix-and-suffix-pairs-i

Simulation

0735-asteroid-collision
1642-water-bottles
1929-concatenation-of-array
2021-remove-all-occurrences-of-a-substring
2791-find-the-losers-of-the-circular-game
3332-minimum-operations-to-exceed-threshold-value-ii
3434-find-the-number-of-distinct-colors-among-the-balls

Matrix

0036-valid-sudoku
0063-unique-paths-ii
0064-minimum-path-sum
0074-search-a-2d-matrix
0085-maximal-rectangle
0212-word-search-ii
0407-trapping-rain-water-ii
0542-01-matrix
0854-making-a-large-island
1396-count-servers-that-communicate
1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
1876-map-of-highest-peak
2145-grid-game
2685-first-completely-painted-row-or-column
2764-maximum-number-of-fish-in-a-grid
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii

Counting

0347-top-k-frequent-elements
0621-task-scheduler
1160-letter-tile-possibilities
1364-tuple-with-same-product
1396-count-servers-that-communicate
1469-minimum-number-of-steps-to-make-two-strings-anagram
1502-construct-k-palindrome-strings
1915-check-if-one-string-swap-can-make-strings-equal
1925-count-nice-pairs-in-an-array
2448-count-number-of-bad-pairs
3455-minimum-length-of-string-after-operations

Brainteaser

2533-bitwise-xor-of-all-pairings

Divide and Conquer

0004-median-of-two-sorted-arrays
0023-merge-k-sorted-lists
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0190-reverse-bits
0191-number-of-1-bits
0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
0973-k-closest-points-to-origin

Shortest Path

1485-minimum-cost-to-make-at-least-one-valid-path-in-a-grid
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii

Union Find

0128-longest-consecutive-sequence
0684-redundant-connection
0801-is-graph-bipartite
0854-making-a-large-island
1396-count-servers-that-communicate
2583-divide-nodes-into-the-maximum-number-of-groups
2764-maximum-number-of-fish-in-a-grid
3219-make-lexicographically-smallest-array-by-swapping-elements

Topological Sort

0207-course-schedule
0210-course-schedule-ii
0820-find-eventual-safe-states
1558-course-schedule-iv
2246-maximum-employees-to-be-invited-to-a-meeting

Counting Sort

1217-relative-sort-array
1365-how-many-numbers-are-smaller-than-the-current-number

Binary Search Tree

0098-validate-binary-search-tree
0099-recover-binary-search-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0450-delete-node-in-a-bst
0653-two-sum-iv-input-is-a-bst
0703-kth-largest-element-in-a-stream

Randomized

0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed

Data Stream

0295-find-median-from-data-stream
0703-kth-largest-element-in-a-stream
0901-online-stock-span
1477-product-of-the-last-k-numbers

Queue

0239-sliding-window-maximum

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
0904-fruit-into-baskets
1004-max-consecutive-ones-iii

Monotonic Queue

0239-sliding-window-maximum

Bucket Sort

0347-top-k-frequent-elements

Quickselect

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

Database

0175-combine-two-tables
0176-second-highest-salary
0178-rank-scores
0180-consecutive-numbers
0181-employees-earning-more-than-their-managers
0184-department-highest-salary
0185-department-top-three-salaries
0196-delete-duplicate-emails
0262-trips-and-users
0550-game-play-analysis-iv
0570-managers-with-at-least-5-direct-reports
0577-employee-bonus
0584-find-customer-referee
0585-investments-in-2016
0595-big-countries
0601-human-traffic-of-stadium
0602-friend-requests-ii-who-has-the-most-friends
0608-tree-node
0610-triangle-judgement
0619-biggest-single-number
0620-not-boring-movies
0626-exchange-seats
1045-customers-who-bought-all-products
1068-product-sales-analysis-i
1070-product-sales-analysis-iii
1075-project-employees-i
1141-user-activity-for-the-past-30-days-i
1148-article-views-i
1164-product-price-at-a-given-date
1174-immediate-food-delivery-ii
1193-monthly-transactions-i
1204-last-person-to-fit-in-the-bus
1251-average-selling-price
1280-students-and-examinations
1321-restaurant-growth
1327-list-the-products-ordered-in-a-period
1341-movie-rating
1378-replace-employee-id-with-the-unique-identifier
1484-group-sold-products-by-the-date
1517-find-users-with-valid-e-mails
1527-patients-with-a-condition
1581-customer-who-visited-but-did-not-make-any-transactions
1633-percentage-of-users-attended-a-contest
1661-average-time-of-process-per-machine
1667-fix-names-in-a-table
1683-invalid-tweets
1729-find-followers-count
1731-the-number-of-employees-which-report-to-each-employee
1757-recyclable-and-low-fat-products
1789-primary-department-for-each-employee
1907-count-salary-categories
1934-confirmation-rate
1978-employees-whose-manager-left-the-company

Union-Find

0128-longest-consecutive-sequence

Doubly-Linked List

0146-lru-cache
0430-flatten-a-multilevel-doubly-linked-list

Merge Sort

0023-merge-k-sorted-lists

Geometry

0973-k-closest-points-to-origin

About

This repo contains all the problems I pricticed from the leetcode for the interview preparations conatins most of problems from the https://neetcode.io/roadmap, https://takeuforward.org/interviews/strivers-sde-sheet-top-coding-interview-problems/ and Blind-75.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors