Skip to content

vatsal30/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

0042-trapping-rain-water
0145-binary-tree-postorder-traversal
0150-evaluate-reverse-polish-notation
0155-min-stack
0678-valid-parenthesis-string
0739-daily-temperatures
0780-max-chunks-to-make-sorted
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

0155-min-stack
0208-implement-trie-prefix-tree
0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed
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
0011-container-with-most-water
0015-3sum
0018-4sum
0027-remove-element
0036-valid-sudoku
0042-trapping-rain-water
0047-permutations-ii
0063-unique-paths-ii
0064-minimum-path-sum
0066-plus-one
0088-merge-sorted-array
0118-pascals-triangle
0119-pascals-triangle-ii
0136-single-number
0139-word-break
0150-evaluate-reverse-polish-notation
0167-two-sum-ii-input-array-is-sorted
0198-house-robber
0213-house-robber-ii
0238-product-of-array-except-self
0239-sliding-window-maximum
0268-missing-number
0283-move-zeroes
0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed
0407-trapping-rain-water-ii
0494-target-sum
0542-01-matrix
0689-maximum-sum-of-3-non-overlapping-subarrays
0739-daily-temperatures
0780-max-chunks-to-make-sorted
0854-making-a-large-island
1025-minimum-cost-for-tickets
1063-best-sightseeing-pair
1217-relative-sort-array
1364-tuple-with-same-product
1396-count-servers-that-communicate
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
2107-find-unique-binary-string
2145-grid-game
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
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
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
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

Greedy

0011-container-with-most-water
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
0088-merge-sorted-array
0242-valid-anagram
0268-missing-number
0389-find-the-difference
0780-max-chunks-to-make-sorted
1217-relative-sort-array
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

0099-recover-binary-search-tree
0124-binary-tree-maximum-path-sum
0145-binary-tree-postorder-traversal
0337-house-robber-iii
0404-sum-of-left-leaves
0515-find-largest-value-in-each-tree-row
0543-diameter-of-binary-tree
0653-two-sum-iv-input-is-a-bst
1093-recover-a-tree-from-preorder-traversal
1387-find-elements-in-a-contaminated-binary-tree
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

0099-recover-binary-search-tree
0124-binary-tree-maximum-path-sum
0145-binary-tree-postorder-traversal
0207-course-schedule
0210-course-schedule-ii
0337-house-robber-iii
0404-sum-of-left-leaves
0515-find-largest-value-in-each-tree-row
0543-diameter-of-binary-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
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

0207-course-schedule
0210-course-schedule-ii
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
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

0099-recover-binary-search-tree
0124-binary-tree-maximum-path-sum
0145-binary-tree-postorder-traversal
0337-house-robber-iii
0404-sum-of-left-leaves
0515-find-largest-value-in-each-tree-row
0543-diameter-of-binary-tree
0653-two-sum-iv-input-is-a-bst
1093-recover-a-tree-from-preorder-traversal
1387-find-elements-in-a-contaminated-binary-tree
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
0027-remove-element
0028-find-the-index-of-the-first-occurrence-in-a-string
0042-trapping-rain-water
0088-merge-sorted-array
0167-two-sum-ii-input-array-is-sorted
0283-move-zeroes
0653-two-sum-iv-input-is-a-bst
1894-merge-strings-alternately
2392-successful-pairs-of-spells-and-potions

String

0022-generate-parentheses
0028-find-the-index-of-the-first-occurrence-in-a-string
0139-word-break
0208-implement-trie-prefix-tree
0242-valid-anagram
0389-find-the-difference
0459-repeated-substring-pattern
0678-valid-parenthesis-string
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
0036-valid-sudoku
0139-word-break
0208-implement-trie-prefix-tree
0242-valid-anagram
0268-missing-number
0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed
0389-find-the-difference
0653-two-sum-iv-input-is-a-bst
1160-letter-tile-possibilities
1217-relative-sort-array
1364-tuple-with-same-product
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
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
0338-counting-bits
0371-sum-of-two-integers
0389-find-the-difference
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
1524-string-matching-in-an-array
2292-counting-words-with-a-given-prefix
3309-count-prefix-and-suffix-pairs-i

Binary Search

0167-two-sum-ii-input-array-is-sorted
0268-missing-number
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)

0239-sliding-window-maximum
0407-trapping-rain-water-ii
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
0118-pascals-triangle
0119-pascals-triangle-ii
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
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
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

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

Recursion

0002-add-two-numbers

Trie

0139-word-break
0208-implement-trie-prefix-tree
3309-count-prefix-and-suffix-pairs-i

Rolling Hash

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

Hash Function

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

Simulation

1642-water-bottles
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
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

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

0190-reverse-bits
0191-number-of-1-bits

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

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

Binary Search Tree

0099-recover-binary-search-tree
0653-two-sum-iv-input-is-a-bst

Randomized

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

Data Stream

1477-product-of-the-last-k-numbers

Queue

0239-sliding-window-maximum

Sliding Window

0239-sliding-window-maximum

Monotonic Queue

0239-sliding-window-maximum

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

No packages published