Skip to content

parnika30/leetcode

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

String

0003-longest-substring-without-repeating-characters
0005-longest-palindromic-substring
0017-letter-combinations-of-a-phone-number
0020-valid-parentheses
0022-generate-parentheses
0049-group-anagrams
0076-minimum-window-substring
0079-word-search
0131-palindrome-partitioning
0139-word-break
0208-implement-trie-prefix-tree
0211-design-add-and-search-words-data-structure
0297-serialize-and-deserialize-binary-tree
0392-is-subsequence
0394-decode-string
0424-longest-repeating-character-replacement
0516-longest-palindromic-subsequence
0567-permutation-in-string
0647-palindromic-substrings
0680-valid-palindrome-ii
0778-reorganize-string
1023-time-based-key-value-store
1250-longest-common-subsequence
1360-maximum-length-of-a-concatenated-string-with-unique-characters
1430-find-the-k-beauty-of-a-number
1460-number-of-substrings-containing-all-three-characters
1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
1873-longest-nice-substring
2186-count-vowel-substrings-of-a-string
2463-minimum-recolors-to-get-k-consecutive-black-blocks
2605-count-anagrams
3893-generate-tag-for-video-caption

Dynamic Programming

0005-longest-palindromic-substring
0022-generate-parentheses
0042-trapping-rain-water
0055-jump-game
0062-unique-paths
0064-minimum-path-sum
0070-climbing-stairs
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0124-binary-tree-maximum-path-sum
0131-palindrome-partitioning
0139-word-break
0198-house-robber
0213-house-robber-ii
0300-longest-increasing-subsequence
0322-coin-change
0392-is-subsequence
0416-partition-equal-subset-sum
0435-non-overlapping-intervals
0494-target-sum
0516-longest-palindromic-subsequence
0518-coin-change-ii
0647-palindromic-substrings
0747-min-cost-climbing-stairs
0905-length-of-longest-fibonacci-subsequence
1013-fibonacci-number
1250-longest-common-subsequence
1631-number-of-sub-arrays-with-odd-sum
1849-maximum-absolute-sum-of-any-subarray

Backtracking

0017-letter-combinations-of-a-phone-number
0022-generate-parentheses
0040-combination-sum-ii
0046-permutations
0051-n-queens
0052-n-queens-ii
0077-combinations
0079-word-search
0131-palindrome-partitioning
0494-target-sum
1360-maximum-length-of-a-concatenated-string-with-unique-characters

Array

0004-median-of-two-sorted-arrays
0015-3sum
0016-3sum-closest
0018-4sum
0026-remove-duplicates-from-sorted-array
0027-remove-element
0033-search-in-rotated-sorted-array
0036-valid-sudoku
0040-combination-sum-ii
0041-first-missing-positive
0042-trapping-rain-water
0046-permutations
0048-rotate-image
0049-group-anagrams
0051-n-queens
0054-spiral-matrix
0055-jump-game
0056-merge-intervals
0057-insert-interval
0064-minimum-path-sum
0073-set-matrix-zeroes
0079-word-search
0084-largest-rectangle-in-histogram
0088-merge-sorted-array
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0128-longest-consecutive-sequence
0130-surrounded-regions
0139-word-break
0150-evaluate-reverse-polish-notation
0153-find-minimum-in-rotated-sorted-array
0169-majority-element
0198-house-robber
0200-number-of-islands
0213-house-robber-ii
0215-kth-largest-element-in-an-array
0217-contains-duplicate
0219-contains-duplicate-ii
0268-missing-number
0300-longest-increasing-subsequence
0322-coin-change
0378-kth-smallest-element-in-a-sorted-matrix
0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed
0416-partition-equal-subset-sum
0435-non-overlapping-intervals
0455-assign-cookies
0485-max-consecutive-ones
0494-target-sum
0496-next-greater-element-i
0518-coin-change-ii
0532-k-diff-pairs-in-an-array
0621-task-scheduler
0658-find-k-closest-elements
0733-flood-fill
0739-daily-temperatures
0745-find-smallest-letter-greater-than-target
0747-min-cost-climbing-stairs
0816-design-hashset
0817-design-hashmap
0883-car-fleet
0890-lemonade-change
0905-length-of-longest-fibonacci-subsequence
0907-koko-eating-bananas
0925-construct-binary-tree-from-preorder-and-postorder-traversal
0940-fruit-into-baskets
1014-k-closest-points-to-origin
1019-squares-of-a-sorted-array
1028-interval-list-intersections
1036-rotting-oranges
1039-find-the-town-judge
1056-capacity-to-ship-packages-within-d-days
1127-last-stone-weight
1335-maximum-candies-allocated-to-k-children
1360-maximum-length-of-a-concatenated-string-with-unique-characters
1538-maximum-points-you-can-obtain-from-cards
1574-maximum-product-of-two-elements-in-an-array
1631-number-of-sub-arrays-with-odd-sum
1849-maximum-absolute-sum-of-any-subarray
1878-check-if-array-is-sorted-and-rotated
2160-minimum-operations-to-make-a-uni-value-grid
2265-partition-array-according-to-given-pivot
2271-rearrange-array-elements-by-sign
2551-apply-operations-to-an-array
2552-maximum-sum-of-distinct-subarrays-with-length-k
2561-number-of-distinct-averages
2585-delete-greatest-value-in-each-row
2614-maximum-count-of-positive-integer-and-negative-integer
2665-minimum-time-to-repair-cars
2690-house-robber-iv
2707-merge-two-2d-arrays-by-summing-values
3227-find-missing-and-repeated-values
3483-alternating-groups-ii
3610-find-x-sum-of-all-k-long-subarrays-i
3643-zero-array-transformation-ii
3819-count-covered-buildings
3822-fill-a-special-grid
3885-count-special-triplets

Tree

0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0102-binary-tree-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
0116-populating-next-right-pointers-in-each-node
0124-binary-tree-maximum-path-sum
0129-sum-root-to-leaf-numbers
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
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
0513-find-bottom-left-tree-value
0515-find-largest-value-in-each-tree-row
0530-minimum-absolute-difference-in-bst
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0783-search-in-a-binary-search-tree
0789-kth-largest-element-in-a-stream
0925-construct-binary-tree-from-preorder-and-postorder-traversal
1035-cousins-in-binary-tree
1114-binary-search-tree-to-greater-sum-tree
1544-count-good-nodes-in-binary-tree
2384-root-equals-sum-of-children

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
0112-path-sum
0116-populating-next-right-pointers-in-each-node
0124-binary-tree-maximum-path-sum
0129-sum-root-to-leaf-numbers
0130-surrounded-regions
0133-clone-graph
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
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
0310-minimum-height-trees
0513-find-bottom-left-tree-value
0515-find-largest-value-in-each-tree-row
0530-minimum-absolute-difference-in-bst
0543-diameter-of-binary-tree
0547-number-of-provinces
0572-subtree-of-another-tree
0684-redundant-connection
0733-flood-fill
0801-is-graph-bipartite
1035-cousins-in-binary-tree
1114-binary-search-tree-to-greater-sum-tree
1544-count-good-nodes-in-binary-tree

Breadth-First Search

0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0104-maximum-depth-of-binary-tree
0112-path-sum
0116-populating-next-right-pointers-in-each-node
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
0310-minimum-height-trees
0322-coin-change
0513-find-bottom-left-tree-value
0515-find-largest-value-in-each-tree-row
0530-minimum-absolute-difference-in-bst
0547-number-of-provinces
0684-redundant-connection
0733-flood-fill
0801-is-graph-bipartite
1035-cousins-in-binary-tree
1036-rotting-oranges
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
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0110-balanced-binary-tree
0112-path-sum
0116-populating-next-right-pointers-in-each-node
0124-binary-tree-maximum-path-sum
0129-sum-root-to-leaf-numbers
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
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
0513-find-bottom-left-tree-value
0515-find-largest-value-in-each-tree-row
0530-minimum-absolute-difference-in-bst
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0783-search-in-a-binary-search-tree
0789-kth-largest-element-in-a-stream
0925-construct-binary-tree-from-preorder-and-postorder-traversal
1035-cousins-in-binary-tree
1114-binary-search-tree-to-greater-sum-tree
1544-count-good-nodes-in-binary-tree
2384-root-equals-sum-of-children

Stack

0020-valid-parentheses
0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0143-reorder-list
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
0150-evaluate-reverse-polish-notation
0155-min-stack
0394-decode-string
0496-next-greater-element-i
0739-daily-temperatures
0883-car-fleet

Hash Table

0003-longest-substring-without-repeating-characters
0017-letter-combinations-of-a-phone-number
0036-valid-sudoku
0041-first-missing-positive
0049-group-anagrams
0073-set-matrix-zeroes
0076-minimum-window-substring
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0128-longest-consecutive-sequence
0133-clone-graph
0139-word-break
0141-linked-list-cycle
0146-lru-cache
0169-majority-element
0202-happy-number
0208-implement-trie-prefix-tree
0217-contains-duplicate
0219-contains-duplicate-ii
0268-missing-number
0355-design-twitter
0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed
0424-longest-repeating-character-replacement
0496-next-greater-element-i
0532-k-diff-pairs-in-an-array
0567-permutation-in-string
0621-task-scheduler
0778-reorganize-string
0816-design-hashset
0817-design-hashmap
0905-length-of-longest-fibonacci-subsequence
0925-construct-binary-tree-from-preorder-and-postorder-traversal
0940-fruit-into-baskets
1023-time-based-key-value-store
1039-find-the-town-judge
1460-number-of-substrings-containing-all-three-characters
1873-longest-nice-substring
2186-count-vowel-substrings-of-a-string
2552-maximum-sum-of-distinct-subarrays-with-length-k
2561-number-of-distinct-averages
2605-count-anagrams
2707-merge-two-2d-arrays-by-summing-values
3227-find-missing-and-repeated-values
3610-find-x-sum-of-all-k-long-subarrays-i
3819-count-covered-buildings
3885-count-special-triplets

Sorting

0015-3sum
0016-3sum-closest
0018-4sum
0049-group-anagrams
0056-merge-intervals
0088-merge-sorted-array
0169-majority-element
0215-kth-largest-element-in-an-array
0217-contains-duplicate
0268-missing-number
0295-find-median-from-data-stream
0378-kth-smallest-element-in-a-sorted-matrix
0435-non-overlapping-intervals
0455-assign-cookies
0532-k-diff-pairs-in-an-array
0621-task-scheduler
0658-find-k-closest-elements
0778-reorganize-string
0883-car-fleet
1014-k-closest-points-to-origin
1019-squares-of-a-sorted-array
1574-maximum-product-of-two-elements-in-an-array
2160-minimum-operations-to-make-a-uni-value-grid
2561-number-of-distinct-averages
2585-delete-greatest-value-in-each-row
3819-count-covered-buildings

Matrix

0036-valid-sudoku
0048-rotate-image
0054-spiral-matrix
0064-minimum-path-sum
0073-set-matrix-zeroes
0079-word-search
0130-surrounded-regions
0200-number-of-islands
0378-kth-smallest-element-in-a-sorted-matrix
0733-flood-fill
1036-rotting-oranges
2160-minimum-operations-to-make-a-uni-value-grid
2585-delete-greatest-value-in-each-row
3227-find-missing-and-repeated-values
3822-fill-a-special-grid

Union Find

0128-longest-consecutive-sequence
0130-surrounded-regions
0200-number-of-islands
0547-number-of-provinces
0684-redundant-connection
0801-is-graph-bipartite

Math

0002-add-two-numbers
0048-rotate-image
0050-powx-n
0062-unique-paths
0070-climbing-stairs
0150-evaluate-reverse-polish-notation
0202-happy-number
0268-missing-number
0380-insert-delete-getrandom-o1
0381-insert-delete-getrandom-o1-duplicates-allowed
1013-fibonacci-number
1014-k-closest-points-to-origin
1430-find-the-k-beauty-of-a-number
1631-number-of-sub-arrays-with-odd-sum
1889-check-if-number-is-a-sum-of-powers-of-three
2160-minimum-operations-to-make-a-uni-value-grid
2605-count-anagrams
2610-closest-prime-numbers-in-range
2649-count-total-number-of-colored-cells
2998-count-symmetric-integers
3227-find-missing-and-repeated-values

Binary Search

0004-median-of-two-sorted-arrays
0033-search-in-rotated-sorted-array
0153-find-minimum-in-rotated-sorted-array
0222-count-complete-tree-nodes
0268-missing-number
0300-longest-increasing-subsequence
0378-kth-smallest-element-in-a-sorted-matrix
0532-k-diff-pairs-in-an-array
0658-find-k-closest-elements
0745-find-smallest-letter-greater-than-target
0907-koko-eating-bananas
1023-time-based-key-value-store
1056-capacity-to-ship-packages-within-d-days
1335-maximum-candies-allocated-to-k-children
2614-maximum-count-of-positive-integer-and-negative-integer
2665-minimum-time-to-repair-cars
2690-house-robber-iv
3643-zero-array-transformation-ii

Bit Manipulation

0222-count-complete-tree-nodes
0268-missing-number
1360-maximum-length-of-a-concatenated-string-with-unique-characters
1873-longest-nice-substring

Divide and Conquer

0004-median-of-two-sorted-arrays
0023-merge-k-sorted-lists
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0169-majority-element
0215-kth-largest-element-in-an-array
0925-construct-binary-tree-from-preorder-and-postorder-traversal
1014-k-closest-points-to-origin
1873-longest-nice-substring
3822-fill-a-special-grid

String Matching

0572-subtree-of-another-tree
1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence

Hash Function

0572-subtree-of-another-tree
0816-design-hashset
0817-design-hashmap

Binary Search Tree

0098-validate-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
0783-search-in-a-binary-search-tree
0789-kth-largest-element-in-a-stream
1114-binary-search-tree-to-greater-sum-tree

Prefix Sum

1538-maximum-points-you-can-obtain-from-cards
1631-number-of-sub-arrays-with-odd-sum
3643-zero-array-transformation-ii

Two Pointers

0005-longest-palindromic-substring
0015-3sum
0016-3sum-closest
0018-4sum
0019-remove-nth-node-from-end-of-list
0026-remove-duplicates-from-sorted-array
0027-remove-element
0042-trapping-rain-water
0061-rotate-list
0088-merge-sorted-array
0141-linked-list-cycle
0143-reorder-list
0202-happy-number
0295-find-median-from-data-stream
0392-is-subsequence
0455-assign-cookies
0532-k-diff-pairs-in-an-array
0567-permutation-in-string
0647-palindromic-substrings
0658-find-k-closest-elements
0680-valid-palindrome-ii
1019-squares-of-a-sorted-array
1028-interval-list-intersections
1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
2265-partition-array-according-to-given-pivot
2271-rearrange-array-elements-by-sign
2551-apply-operations-to-an-array
2561-number-of-distinct-averages
2707-merge-two-2d-arrays-by-summing-values

Simulation

0054-spiral-matrix
2265-partition-array-according-to-given-pivot
2271-rearrange-array-elements-by-sign
2551-apply-operations-to-an-array
2585-delete-greatest-value-in-each-row
3893-generate-tag-for-video-caption

Memoization

0070-climbing-stairs
0139-word-break
1013-fibonacci-number

Monotonic Stack

0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0496-next-greater-element-i
0739-daily-temperatures
0883-car-fleet

Number Theory

2610-closest-prime-numbers-in-range

Sliding Window

0003-longest-substring-without-repeating-characters
0076-minimum-window-substring
0219-contains-duplicate-ii
0424-longest-repeating-character-replacement
0567-permutation-in-string
0658-find-k-closest-elements
0940-fruit-into-baskets
1430-find-the-k-beauty-of-a-number
1460-number-of-substrings-containing-all-three-characters
1538-maximum-points-you-can-obtain-from-cards
1873-longest-nice-substring
2463-minimum-recolors-to-get-k-consecutive-black-blocks
2552-maximum-sum-of-distinct-subarrays-with-length-k
3483-alternating-groups-ii
3610-find-x-sum-of-all-k-long-subarrays-i

Counting

0169-majority-element
0621-task-scheduler
0778-reorganize-string
2605-count-anagrams
2614-maximum-count-of-positive-integer-and-negative-integer
3885-count-special-triplets

Graph

0133-clone-graph
0207-course-schedule
0210-course-schedule-ii
0310-minimum-height-trees
0547-number-of-provinces
0684-redundant-connection
0801-is-graph-bipartite
1039-find-the-town-judge
1916-find-center-of-star-graph

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
0789-kth-largest-element-in-a-stream
0816-design-hashset
0817-design-hashmap
1023-time-based-key-value-store

Enumeration

2998-count-symmetric-integers

Recursion

0002-add-two-numbers
0021-merge-two-sorted-lists
0050-powx-n
0143-reorder-list
0394-decode-string
1013-fibonacci-number

Topological Sort

0207-course-schedule
0210-course-schedule-ii
0310-minimum-height-trees

Greedy

0055-jump-game
0122-best-time-to-buy-and-sell-stock-ii
0435-non-overlapping-intervals
0455-assign-cookies
0621-task-scheduler
0680-valid-palindrome-ii
0778-reorganize-string
0890-lemonade-change

Linked List

0002-add-two-numbers
0019-remove-nth-node-from-end-of-list
0021-merge-two-sorted-lists
0023-merge-k-sorted-lists
0061-rotate-list
0092-reverse-linked-list-ii
0116-populating-next-right-pointers-in-each-node
0141-linked-list-cycle
0143-reorder-list
0146-lru-cache
0355-design-twitter
0816-design-hashset
0817-design-hashmap

Doubly-Linked List

0146-lru-cache

Line Sweep

1028-interval-list-intersections

Heap (Priority Queue)

0023-merge-k-sorted-lists
0215-kth-largest-element-in-an-array
0295-find-median-from-data-stream
0355-design-twitter
0378-kth-smallest-element-in-a-sorted-matrix
0621-task-scheduler
0658-find-k-closest-elements
0778-reorganize-string
0789-kth-largest-element-in-a-stream
1014-k-closest-points-to-origin
1127-last-stone-weight
1574-maximum-product-of-two-elements-in-an-array
2585-delete-greatest-value-in-each-row
3610-find-x-sum-of-all-k-long-subarrays-i

Merge Sort

0023-merge-k-sorted-lists

Trie

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

Data Stream

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

Geometry

1014-k-closest-points-to-origin

Quickselect

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

Randomized

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

Combinatorics

0062-unique-paths
2605-count-anagrams

Concurrency

1186-building-h2o
1187-print-foobar-alternately
1203-print-in-order
1216-print-zero-even-odd

About

leetcode solutions by parnika

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published