Skip to content

himanshugupta09/LEETCODE_SOLUTIONS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This Repository Contains all The Questions From the LeetCode Platform

LeetCode Topics

Array

0001-two-sum
0011-container-with-most-water
0015-3sum
0033-search-in-rotated-sorted-array
0053-maximum-subarray
0056-merge-intervals
0073-set-matrix-zeroes
0075-sort-colors
0120-triangle
0121-best-time-to-buy-and-sell-stock
0128-longest-consecutive-sequence
0135-candy
0139-word-break
0152-maximum-product-subarray
0200-number-of-islands
0238-product-of-array-except-self
0300-longest-increasing-subsequence
0322-coin-change
0368-largest-divisible-subset
0417-pacific-atlantic-water-flow
0498-diagonal-traverse
0594-longest-harmonious-subsequence
0611-valid-triangle-number
0645-set-mismatch
0797-rabbits-in-forest
0830-largest-triangle-area
0854-making-a-large-island
0905-length-of-longest-fibonacci-subsequence
0925-construct-binary-tree-from-preorder-and-postorder-traversal
0945-snakes-and-ladders
1006-vowel-spellchecker
1018-largest-perimeter-triangle
1049-minimum-domino-rotations-for-equal-row
1227-number-of-equivalent-domino-pairs
1293-three-consecutive-odds
1335-maximum-candies-allocated-to-k-children
1353-find-resultant-array-after-removing-anagrams
1364-tuple-with-same-product
1421-find-numbers-with-even-number-of-digits
1424-maximum-candies-you-can-get-from-boxes
1426-find-n-unique-integers-sum-up-to-zero
1477-product-of-the-last-k-numbers
1510-find-lucky-integer-in-an-array
1621-number-of-subsequences-that-satisfy-the-given-sum-condition
1631-number-of-sub-arrays-with-odd-sum
1656-count-good-triplets
1819-construct-the-lexicographically-largest-valid-sequence
1849-maximum-absolute-sum-of-any-subarray
1878-check-if-array-is-sorted-and-rotated
1927-maximum-ascending-subarray-sum
1993-sum-of-all-subset-xor-totals
2048-build-array-from-permutation
2058-concatenation-of-array
2107-find-unique-binary-string
2144-maximum-difference-between-increasing-elements
2150-kth-smallest-product-of-two-sorted-arrays
2160-minimum-operations-to-make-a-uni-value-grid
2180-maximum-number-of-tasks-you-can-assign
2215-finding-3-digit-even-numbers
2220-find-all-possible-recipes-from-given-supplies
2237-longest-palindrome-by-concatenating-two-letter-words
2249-count-the-hidden-sequences
2265-partition-array-according-to-given-pivot
2277-count-equal-and-divisible-pairs-in-an-array
2307-replace-non-coprime-numbers-in-array
2320-find-all-k-distant-indices-in-an-array
2429-design-a-food-rating-system
2448-count-number-of-bad-pairs
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2527-count-subarrays-with-fixed-bounds
2551-apply-operations-to-an-array
2614-maximum-count-of-positive-integer-and-negative-integer
2681-put-marbles-in-bags
2699-count-the-number-of-fair-pairs
2707-merge-two-2d-arrays-by-summing-values
2856-count-complete-subarrays-in-an-array
2888-minimum-index-of-a-valid-split
2915-count-of-interesting-subarrays
3142-longest-unequal-adjacent-groups-subsequence-ii
3143-longest-unequal-adjacent-groups-subsequence-i
3152-maximum-value-of-an-ordered-triplet-ii
3154-maximum-value-of-an-ordered-triplet-i
3171-minimum-equal-sum-of-two-arrays-after-replacing-zeros
3194-find-words-containing-character
3213-count-subarrays-where-max-element-appears-at-least-k-times
3227-find-missing-and-repeated-values
3242-count-elements-with-maximum-frequency
3251-maximum-area-of-longest-diagonal-rectangle
3307-find-the-maximum-sum-of-node-values
3321-type-of-triangle
3332-minimum-operations-to-exceed-threshold-value-ii
3372-longest-strictly-increasing-or-strictly-decreasing-subarray
3430-count-days-without-meetings
3434-find-the-number-of-distinct-colors-among-the-balls
3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i
3483-alternating-groups-ii
3581-the-two-sneaky-numbers-of-digitville
3627-find-minimum-time-to-reach-last-room-i
3639-zero-array-transformation-i
3643-zero-array-transformation-ii
3647-zero-array-transformation-iii
3685-count-subarrays-of-length-three-with-a-condition
3747-maximum-difference-between-adjacent-elements-in-a-circular-array

Depth-First Search

0100-same-tree
0104-maximum-depth-of-binary-tree
0133-clone-graph
0200-number-of-islands
0207-course-schedule
0211-design-add-and-search-words-data-structure
0386-lexicographical-numbers
0417-pacific-atlantic-water-flow
0854-making-a-large-island
1093-recover-a-tree-from-preorder-traversal
1387-find-elements-in-a-contaminated-binary-tree
2438-find-closest-node-to-given-two-nodes
2793-count-the-number-of-complete-components
3633-maximize-the-number-of-target-nodes-after-connecting-trees-i
3645-maximize-the-number-of-target-nodes-after-connecting-trees-ii

Breadth-First Search

0100-same-tree
0104-maximum-depth-of-binary-tree
0133-clone-graph
0200-number-of-islands
0207-course-schedule
0322-coin-change
0417-pacific-atlantic-water-flow
0854-making-a-large-island
0945-snakes-and-ladders
1387-find-elements-in-a-contaminated-binary-tree
1424-maximum-candies-you-can-get-from-boxes
2793-count-the-number-of-complete-components
3633-maximize-the-number-of-target-nodes-after-connecting-trees-i
3645-maximize-the-number-of-target-nodes-after-connecting-trees-ii

Union Find

0128-longest-consecutive-sequence
0200-number-of-islands
0854-making-a-large-island
1058-lexicographically-smallest-equivalent-string
2793-count-the-number-of-complete-components

Matrix

0073-set-matrix-zeroes
0200-number-of-islands
0417-pacific-atlantic-water-flow
0498-diagonal-traverse
0854-making-a-large-island
0945-snakes-and-ladders
2160-minimum-operations-to-make-a-uni-value-grid
3227-find-missing-and-repeated-values
3627-find-minimum-time-to-reach-last-room-i

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0073-set-matrix-zeroes
0128-longest-consecutive-sequence
0133-clone-graph
0139-word-break
0141-linked-list-cycle
0242-valid-anagram
0594-longest-harmonious-subsequence
0645-set-mismatch
0768-partition-labels
0797-rabbits-in-forest
0905-length-of-longest-fibonacci-subsequence
0925-construct-binary-tree-from-preorder-and-postorder-traversal
1006-vowel-spellchecker
1160-letter-tile-possibilities
1227-number-of-equivalent-domino-pairs
1264-maximum-number-of-words-you-can-type
1353-find-resultant-array-after-removing-anagrams
1364-tuple-with-same-product
1387-find-elements-in-a-contaminated-binary-tree
1460-number-of-substrings-containing-all-three-characters
1500-count-largest-group
1510-find-lucky-integer-in-an-array
1915-check-if-one-string-swap-can-make-strings-equal
1986-largest-color-value-in-a-directed-graph
2107-find-unique-binary-string
2215-finding-3-digit-even-numbers
2220-find-all-possible-recipes-from-given-supplies
2237-longest-palindrome-by-concatenating-two-letter-words
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
2520-using-a-robot-to-print-the-lexicographically-smallest-string
2707-merge-two-2d-arrays-by-summing-values
2856-count-complete-subarrays-in-an-array
2888-minimum-index-of-a-valid-split
2915-count-of-interesting-subarrays
3227-find-missing-and-repeated-values
3242-count-elements-with-maximum-frequency
3434-find-the-number-of-distinct-colors-among-the-balls
3445-lexicographically-minimum-string-after-removing-stars
3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii
3581-the-two-sneaky-numbers-of-digitville
3629-total-characters-in-string-after-transformations-i
3630-total-characters-in-string-after-transformations-ii
3753-maximum-difference-between-even-and-odd-frequency-i
3872-find-most-frequent-vowel-and-consonant

String

0003-longest-substring-without-repeating-characters
0005-longest-palindromic-substring
0006-zigzag-conversion
0020-valid-parentheses
0038-count-and-say
0139-word-break
0165-compare-version-numbers
0211-design-add-and-search-words-data-structure
0242-valid-anagram
0768-partition-labels
0868-push-dominoes
1006-vowel-spellchecker
1058-lexicographically-smallest-equivalent-string
1093-recover-a-tree-from-preorder-traversal
1160-letter-tile-possibilities
1250-longest-common-subsequence
1264-maximum-number-of-words-you-can-type
1353-find-resultant-array-after-removing-anagrams
1460-number-of-substrings-containing-all-three-characters
1516-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
1915-check-if-one-string-swap-can-make-strings-equal
2021-remove-all-occurrences-of-a-substring
2107-find-unique-binary-string
2220-find-all-possible-recipes-from-given-supplies
2237-longest-palindrome-by-concatenating-two-letter-words
2260-divide-a-string-into-groups-of-size-k
2429-design-a-food-rating-system
2463-minimum-recolors-to-get-k-consecutive-black-blocks
2520-using-a-robot-to-print-the-lexicographically-smallest-string
2887-sort-vowels-in-a-string
3142-longest-unequal-adjacent-groups-subsequence-ii
3143-longest-unequal-adjacent-groups-subsequence-i
3194-find-words-containing-character
3445-lexicographically-minimum-string-after-removing-stars
3447-clear-digits
3462-vowels-game-in-a-string
3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii
3617-find-the-original-typed-string-i
3629-total-characters-in-string-after-transformations-i
3630-total-characters-in-string-after-transformations-ii
3637-count-number-of-balanced-permutations
3683-find-the-lexicographically-largest-string-from-the-box-i
3753-maximum-difference-between-even-and-odd-frequency-i
3872-find-most-frequent-vowel-and-consonant

Counting

0594-longest-harmonious-subsequence
1160-letter-tile-possibilities
1227-number-of-equivalent-domino-pairs
1364-tuple-with-same-product
1510-find-lucky-integer-in-an-array
1915-check-if-one-string-swap-can-make-strings-equal
1986-largest-color-value-in-a-directed-graph
2237-longest-palindrome-by-concatenating-two-letter-words
2448-count-number-of-bad-pairs
2614-maximum-count-of-positive-integer-and-negative-integer
3242-count-elements-with-maximum-frequency
3629-total-characters-in-string-after-transformations-i
3630-total-characters-in-string-after-transformations-ii
3753-maximum-difference-between-even-and-odd-frequency-i
3872-find-most-frequent-vowel-and-consonant

Simulation

0498-diagonal-traverse
2021-remove-all-occurrences-of-a-substring
2048-build-array-from-permutation
2058-concatenation-of-array
2260-divide-a-string-into-groups-of-size-k
2265-partition-array-according-to-given-pivot
2551-apply-operations-to-an-array
3332-minimum-operations-to-exceed-threshold-value-ii
3434-find-the-number-of-distinct-colors-among-the-balls
3447-clear-digits

Design

0211-design-add-and-search-words-data-structure
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

Heap (Priority Queue)

2429-design-a-food-rating-system
2434-design-a-number-container-system
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2681-put-marbles-in-bags
3332-minimum-operations-to-exceed-threshold-value-ii
3445-lexicographically-minimum-string-after-removing-stars
3627-find-minimum-time-to-reach-last-room-i
3647-zero-array-transformation-iii

Ordered Set

2429-design-a-food-rating-system
2434-design-a-number-container-system

Math

0062-unique-paths
0368-largest-divisible-subset
0797-rabbits-in-forest
0830-largest-triangle-area
1018-largest-perimeter-triangle
1411-convert-binary-number-in-a-linked-list-to-integer
1421-find-numbers-with-even-number-of-digits
1426-find-n-unique-integers-sum-up-to-zero
1440-convert-integer-to-the-sum-of-two-no-zero-integers
1477-product-of-the-last-k-numbers
1500-count-largest-group
1529-max-difference-you-can-get-from-changing-an-integer
1631-number-of-sub-arrays-with-odd-sum
1889-check-if-number-is-a-sum-of-powers-of-three
1993-sum-of-all-subset-xor-totals
2160-minimum-operations-to-make-a-uni-value-grid
2307-replace-non-coprime-numbers-in-array
2415-count-the-number-of-ideal-arrays
2448-count-number-of-bad-pairs
2610-closest-prime-numbers-in-range
2704-maximum-difference-by-remapping-a-digit
2802-find-the-punishment-number-of-an-integer
3172-divisible-and-non-divisible-sums-difference
3227-find-missing-and-repeated-values
3321-type-of-triangle
3462-vowels-game-in-a-string
3581-the-two-sneaky-numbers-of-digitville
3629-total-characters-in-string-after-transformations-i
3630-total-characters-in-string-after-transformations-ii
3637-count-number-of-balanced-permutations
3830-find-closest-person

Stack

0020-valid-parentheses
2021-remove-all-occurrences-of-a-substring
2307-replace-non-coprime-numbers-in-array
2520-using-a-robot-to-print-the-lexicographically-smallest-string
3445-lexicographically-minimum-string-after-removing-stars
3447-clear-digits

Sorting

0015-3sum
0056-merge-intervals
0075-sort-colors
0242-valid-anagram
0368-largest-divisible-subset
0594-longest-harmonious-subsequence
0611-valid-triangle-number
0645-set-mismatch
1018-largest-perimeter-triangle
1353-find-resultant-array-after-removing-anagrams
1621-number-of-subsequences-that-satisfy-the-given-sum-condition
2160-minimum-operations-to-make-a-uni-value-grid
2180-maximum-number-of-tasks-you-can-assign
2215-finding-3-digit-even-numbers
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2681-put-marbles-in-bags
2699-count-the-number-of-fair-pairs
2887-sort-vowels-in-a-string
2888-minimum-index-of-a-valid-split
3307-find-the-maximum-sum-of-node-values
3321-type-of-triangle
3430-count-days-without-meetings
3647-zero-array-transformation-iii

Data Stream

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

Prefix Sum

0238-product-of-array-except-self
1477-product-of-the-last-k-numbers
1631-number-of-sub-arrays-with-odd-sum
2249-count-the-hidden-sequences
2915-count-of-interesting-subarrays
3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i
3639-zero-array-transformation-i
3643-zero-array-transformation-ii
3647-zero-array-transformation-iii

Backtracking

1160-letter-tile-possibilities
1516-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
1819-construct-the-lexicographically-largest-valid-sequence
1993-sum-of-all-subset-xor-totals
2107-find-unique-binary-string
2802-find-the-punishment-number-of-an-integer

Tree

0100-same-tree
0104-maximum-depth-of-binary-tree
0925-construct-binary-tree-from-preorder-and-postorder-traversal
1093-recover-a-tree-from-preorder-traversal
1387-find-elements-in-a-contaminated-binary-tree
3307-find-the-maximum-sum-of-node-values
3633-maximize-the-number-of-target-nodes-after-connecting-trees-i
3645-maximize-the-number-of-target-nodes-after-connecting-trees-ii

Binary Tree

0100-same-tree
0104-maximum-depth-of-binary-tree
0925-construct-binary-tree-from-preorder-and-postorder-traversal
1093-recover-a-tree-from-preorder-traversal
1387-find-elements-in-a-contaminated-binary-tree

Divide and Conquer

0053-maximum-subarray
0925-construct-binary-tree-from-preorder-and-postorder-traversal

Dynamic Programming

0005-longest-palindromic-substring
0053-maximum-subarray
0062-unique-paths
0120-triangle
0121-best-time-to-buy-and-sell-stock
0139-word-break
0152-maximum-product-subarray
0300-longest-increasing-subsequence
0322-coin-change
0368-largest-divisible-subset
0806-domino-and-tromino-tiling
0868-push-dominoes
0905-length-of-longest-fibonacci-subsequence
1250-longest-common-subsequence
1631-number-of-sub-arrays-with-odd-sum
1849-maximum-absolute-sum-of-any-subarray
1986-largest-color-value-in-a-directed-graph
2061-painting-a-grid-with-three-different-colors
2415-count-the-number-of-ideal-arrays
3142-longest-unequal-adjacent-groups-subsequence-ii
3143-longest-unequal-adjacent-groups-subsequence-i
3307-find-the-maximum-sum-of-node-values
3629-total-characters-in-string-after-transformations-i
3630-total-characters-in-string-after-transformations-ii
3637-count-number-of-balanced-permutations

Two Pointers

0005-longest-palindromic-substring
0011-container-with-most-water
0015-3sum
0019-remove-nth-node-from-end-of-list
0075-sort-colors
0141-linked-list-cycle
0165-compare-version-numbers
0611-valid-triangle-number
0768-partition-labels
0868-push-dominoes
1621-number-of-subsequences-that-satisfy-the-given-sum-condition
2265-partition-array-according-to-given-pivot
2320-find-all-k-distant-indices-in-an-array
2551-apply-operations-to-an-array
2699-count-the-number-of-fair-pairs
2707-merge-two-2d-arrays-by-summing-values
3683-find-the-lexicographically-largest-string-from-the-box-i

Number Theory

2307-replace-non-coprime-numbers-in-array
2415-count-the-number-of-ideal-arrays
2610-closest-prime-numbers-in-range

Sliding Window

0003-longest-substring-without-repeating-characters
0594-longest-harmonious-subsequence
1460-number-of-substrings-containing-all-three-characters
2463-minimum-recolors-to-get-k-consecutive-black-blocks
2527-count-subarrays-with-fixed-bounds
2856-count-complete-subarrays-in-an-array
3213-count-subarrays-where-max-element-appears-at-least-k-times
3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i
3483-alternating-groups-ii
3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii

Binary Search

0033-search-in-rotated-sorted-array
0300-longest-increasing-subsequence
0611-valid-triangle-number
1335-maximum-candies-allocated-to-k-children
1621-number-of-subsequences-that-satisfy-the-given-sum-condition
2150-kth-smallest-product-of-two-sorted-arrays
2180-maximum-number-of-tasks-you-can-assign
2614-maximum-count-of-positive-integer-and-negative-integer
2699-count-the-number-of-fair-pairs
3643-zero-array-transformation-ii

Bit Manipulation

0645-set-mismatch
1993-sum-of-all-subset-xor-totals
3307-find-the-maximum-sum-of-node-values
3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i

Queue

2180-maximum-number-of-tasks-you-can-assign
2527-count-subarrays-with-fixed-bounds
3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i

Graph

0133-clone-graph
0207-course-schedule
1424-maximum-candies-you-can-get-from-boxes
1986-largest-color-value-in-a-directed-graph
2220-find-all-possible-recipes-from-given-supplies
2438-find-closest-node-to-given-two-nodes
2793-count-the-number-of-complete-components
3627-find-minimum-time-to-reach-last-room-i

Topological Sort

0207-course-schedule
1986-largest-color-value-in-a-directed-graph
2220-find-all-possible-recipes-from-given-supplies

Greedy

0011-container-with-most-water
0135-candy
0611-valid-triangle-number
0768-partition-labels
0797-rabbits-in-forest
1018-largest-perimeter-triangle
1049-minimum-domino-rotations-for-equal-row
1529-max-difference-you-can-get-from-changing-an-integer
2180-maximum-number-of-tasks-you-can-assign
2237-longest-palindrome-by-concatenating-two-letter-words
2520-using-a-robot-to-print-the-lexicographically-smallest-string
2681-put-marbles-in-bags
2704-maximum-difference-by-remapping-a-digit
3143-longest-unequal-adjacent-groups-subsequence-i
3171-minimum-equal-sum-of-two-arrays-after-replacing-zeros
3307-find-the-maximum-sum-of-node-values
3445-lexicographically-minimum-string-after-removing-stars
3647-zero-array-transformation-iii

Combinatorics

0062-unique-paths
1993-sum-of-all-subset-xor-totals
2415-count-the-number-of-ideal-arrays
3637-count-number-of-balanced-permutations

Enumeration

1656-count-good-triplets
1993-sum-of-all-subset-xor-totals
2215-finding-3-digit-even-numbers
3683-find-the-lexicographically-largest-string-from-the-box-i

Monotonic Queue

2180-maximum-number-of-tasks-you-can-assign
2527-count-subarrays-with-fixed-bounds

Shortest Path

3627-find-minimum-time-to-reach-last-room-i

Memoization

0139-word-break
1986-largest-color-value-in-a-directed-graph

Trie

0139-word-break
0211-design-add-and-search-words-data-structure
0386-lexicographical-numbers

Linked List

0019-remove-nth-node-from-end-of-list
0021-merge-two-sorted-lists
0141-linked-list-cycle
0206-reverse-linked-list
1411-convert-binary-number-in-a-linked-list-to-integer

Brainteaser

3462-vowels-game-in-a-string

Game Theory

3462-vowels-game-in-a-string

Recursion

0021-merge-two-sorted-lists
0206-reverse-linked-list

Geometry

0830-largest-triangle-area

About

This Repository Contains DSA Problems From LeetCode Daily And Challanges Solutions

Topics

Resources

Stars

Watchers

Forks