Skip to content

1abdelhalim/LeetCode-Solutions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode-Problems

This repository contains solutions for problems found on LeetCode.

LeetCode Topics

String

0017-letter-combinations-of-a-phone-number
0093-restore-ip-addresses
0131-palindrome-partitioning
0139-word-break
0187-repeated-dna-sequences
0212-word-search-ii
0345-reverse-vowels-of-a-string
0387-first-unique-character-in-a-string
0389-find-the-difference
0415-add-strings
0449-serialize-and-deserialize-bst
0567-permutation-in-string
0648-replace-words
0721-accounts-merge
0812-rotate-string
0920-uncommon-words-from-two-sentences
1023-time-based-key-value-store
1156-occurrences-after-bigram
1524-string-matching-in-an-array
1537-maximum-score-after-splitting-a-string
1720-crawler-log-folder
1786-count-the-number-of-consistent-strings
1895-minimum-number-of-operations-to-move-all-balls-to-each-box
1899-count-items-matching-a-rule
1915-check-if-one-string-swap-can-make-strings-equal
2088-minimum-time-to-type-word-using-special-typewriter
2163-kth-distinct-string-in-an-array
2292-counting-words-with-a-given-prefix
2487-optimal-partition-of-string
2502-sort-the-people
2800-minimum-string-length-after-removing-substrings
3309-count-prefix-and-suffix-pairs-i
3447-clear-digits

Bit Manipulation

0078-subsets
0090-subsets-ii
0136-single-number
0187-repeated-dna-sequences
0191-number-of-1-bits
0389-find-the-difference
0461-hamming-distance
0476-number-complement
1444-number-of-steps-to-reduce-a-number-to-zero
1610-xor-operation-in-an-array
1786-count-the-number-of-consistent-strings
2170-count-number-of-maximum-bitwise-or-subsets
2323-minimum-bit-flips-to-convert-number
3193-maximum-strong-pair-xor-i
3380-shortest-subarray-with-or-at-least-k-ii

Array

0001-two-sum
0004-median-of-two-sorted-arrays
0015-3sum
0026-remove-duplicates-from-sorted-array
0039-combination-sum
0040-combination-sum-ii
0047-permutations-ii
0051-n-queens
0056-merge-intervals
0078-subsets
0090-subsets-ii
0136-single-number
0139-word-break
0200-number-of-islands
0212-word-search-ii
0239-sliding-window-maximum
0283-move-zeroes
0329-longest-increasing-path-in-a-matrix
0414-third-maximum-number
0435-non-overlapping-intervals
0503-next-greater-element-ii
0506-relative-ranks
0621-task-scheduler
0648-replace-words
0654-maximum-binary-tree
0682-baseball-game
0695-max-area-of-island
0721-accounts-merge
0733-flood-fill
0830-largest-triangle-area
0890-lemonade-change
0912-random-pick-with-weight
0917-boats-to-save-people
1036-rotting-oranges
1050-construct-binary-search-tree-from-preorder-traversal
1127-last-stone-weight
1227-number-of-equivalent-domino-pairs
1256-rank-transform-of-an-array
1325-path-with-maximum-probability
1396-count-servers-that-communicate
1468-check-if-n-and-its-double-exist
1505-create-target-array-in-the-given-order
1524-string-matching-in-an-array
1570-final-prices-with-a-special-discount-in-a-shop
1574-maximum-product-of-two-elements-in-an-array
1693-sum-of-all-odd-length-subarrays
1720-crawler-log-folder
1786-count-the-number-of-consistent-strings
1895-minimum-number-of-operations-to-move-all-balls-to-each-box
1899-count-items-matching-a-rule
2106-find-greatest-common-divisor-of-array
2112-minimum-difference-between-highest-and-lowest-of-k-scores
2122-count-special-quadruplets
2132-convert-1d-array-into-2d-array
2163-kth-distinct-string-in-an-array
2170-count-number-of-maximum-bitwise-or-subsets
2210-find-target-indices-after-sorting-array
2292-counting-words-with-a-given-prefix
2316-count-hills-and-valleys-in-an-array
2375-minimum-obstacle-removal-to-reach-corner
2502-sort-the-people
2551-apply-operations-to-an-array
2614-maximum-count-of-positive-integer-and-negative-integer
2692-take-gifts-from-the-richest-pile
2707-merge-two-2d-arrays-by-summing-values
3154-maximum-value-of-an-ordered-triplet-i
3193-maximum-strong-pair-xor-i
3206-find-common-elements-between-two-arrays
3251-maximum-area-of-longest-diagonal-rectangle
3309-count-prefix-and-suffix-pairs-i
3380-shortest-subarray-with-or-at-least-k-ii
3429-special-array-i
3471-minimum-average-of-smallest-and-largest-elements
3476-find-minimum-operations-to-make-all-elements-divisible-by-three
3555-final-array-state-after-k-multiplication-operations-i
3581-the-two-sneaky-numbers-of-digitville

Heap (Priority Queue)

0239-sliding-window-maximum
0506-relative-ranks
0621-task-scheduler
0744-network-delay-time
0789-kth-largest-element-in-a-stream
1127-last-stone-weight
1325-path-with-maximum-probability
1574-maximum-product-of-two-elements-in-an-array
2375-minimum-obstacle-removal-to-reach-corner
2692-take-gifts-from-the-richest-pile
3555-final-array-state-after-k-multiplication-operations-i

Tree

0098-validate-binary-search-tree
0449-serialize-and-deserialize-bst
0530-minimum-absolute-difference-in-bst
0654-maximum-binary-tree
0789-kth-largest-element-in-a-stream
0930-all-possible-full-binary-trees
1050-construct-binary-search-tree-from-preorder-traversal
1243-sum-of-nodes-with-even-valued-grandparent
1544-count-good-nodes-in-binary-tree
2347-count-nodes-equal-to-average-of-subtree

Design

0225-implement-stack-using-queues
0449-serialize-and-deserialize-bst
0789-kth-largest-element-in-a-stream
0931-maximum-frequency-stack
1023-time-based-key-value-store
1708-design-parking-system

Binary Search Tree

0004-median-of-two-sorted-arrays
0098-validate-binary-search-tree
0449-serialize-and-deserialize-bst
0530-minimum-absolute-difference-in-bst
0789-kth-largest-element-in-a-stream
0912-random-pick-with-weight
1023-time-based-key-value-store
1050-construct-binary-search-tree-from-preorder-traversal
1468-check-if-n-and-its-double-exist
2210-find-target-indices-after-sorting-array
2614-maximum-count-of-positive-integer-and-negative-integer

Binary Tree

0098-validate-binary-search-tree
0449-serialize-and-deserialize-bst
0530-minimum-absolute-difference-in-bst
0654-maximum-binary-tree
0789-kth-largest-element-in-a-stream
0930-all-possible-full-binary-trees
1050-construct-binary-search-tree-from-preorder-traversal
1243-sum-of-nodes-with-even-valued-grandparent
1544-count-good-nodes-in-binary-tree
2347-count-nodes-equal-to-average-of-subtree

Data Stream

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

Math

0050-powx-n
0070-climbing-stairs
0292-nim-game
0319-bulb-switcher
0326-power-of-three
0415-add-strings
0830-largest-triangle-area
0912-random-pick-with-weight
1362-airplane-seat-assignment-probability
1444-number-of-steps-to-reduce-a-number-to-zero
1585-the-kth-factor-of-n
1610-xor-operation-in-an-array
1693-sum-of-all-odd-length-subarrays
1965-sum-of-digits-in-base-k
2106-find-greatest-common-divisor-of-array
3476-find-minimum-operations-to-make-all-elements-divisible-by-three
3555-final-array-state-after-k-multiplication-operations-i
3581-the-two-sneaky-numbers-of-digitville

Greedy

0435-non-overlapping-intervals
0621-task-scheduler
0770-couples-holding-hands
0890-lemonade-change
0917-boats-to-save-people
2088-minimum-time-to-type-word-using-special-typewriter
2487-optimal-partition-of-string

Hash Table

0001-two-sum
0017-letter-combinations-of-a-phone-number
0133-clone-graph
0139-word-break
0187-repeated-dna-sequences
0387-first-unique-character-in-a-string
0389-find-the-difference
0567-permutation-in-string
0621-task-scheduler
0648-replace-words
0721-accounts-merge
0920-uncommon-words-from-two-sentences
0931-maximum-frequency-stack
1023-time-based-key-value-store
1227-number-of-equivalent-domino-pairs
1256-rank-transform-of-an-array
1468-check-if-n-and-its-double-exist
1786-count-the-number-of-consistent-strings
1915-check-if-one-string-swap-can-make-strings-equal
2122-count-special-quadruplets
2163-kth-distinct-string-in-an-array
2487-optimal-partition-of-string
2502-sort-the-people
2707-merge-two-2d-arrays-by-summing-values
3193-maximum-strong-pair-xor-i
3206-find-common-elements-between-two-arrays
3581-the-two-sneaky-numbers-of-digitville

Sorting

0015-3sum
0047-permutations-ii
0056-merge-intervals
0389-find-the-difference
0414-third-maximum-number
0435-non-overlapping-intervals
0506-relative-ranks
0621-task-scheduler
0721-accounts-merge
0917-boats-to-save-people
1256-rank-transform-of-an-array
1468-check-if-n-and-its-double-exist
1574-maximum-product-of-two-elements-in-an-array
2112-minimum-difference-between-highest-and-lowest-of-k-scores
2210-find-target-indices-after-sorting-array
2502-sort-the-people
3471-minimum-average-of-smallest-and-largest-elements

Matrix

0200-number-of-islands
0212-word-search-ii
0329-longest-increasing-path-in-a-matrix
0695-max-area-of-island
0733-flood-fill
1036-rotting-oranges
1396-count-servers-that-communicate
2132-convert-1d-array-into-2d-array
2375-minimum-obstacle-removal-to-reach-corner

Simulation

0415-add-strings
0682-baseball-game
1505-create-target-array-in-the-given-order
1708-design-parking-system
2132-convert-1d-array-into-2d-array
2551-apply-operations-to-an-array
2692-take-gifts-from-the-richest-pile
2800-minimum-string-length-after-removing-substrings
3447-clear-digits
3555-final-array-state-after-k-multiplication-operations-i

Divide and Conquer

0004-median-of-two-sorted-arrays
0191-number-of-1-bits
0654-maximum-binary-tree

Stack

0225-implement-stack-using-queues
0503-next-greater-element-ii
0654-maximum-binary-tree
0682-baseball-game
0931-maximum-frequency-stack
1050-construct-binary-search-tree-from-preorder-traversal
1570-final-prices-with-a-special-discount-in-a-shop
1720-crawler-log-folder
2800-minimum-string-length-after-removing-substrings
3447-clear-digits

Monotonic Stack

0503-next-greater-element-ii
0654-maximum-binary-tree
1050-construct-binary-search-tree-from-preorder-traversal
1570-final-prices-with-a-special-discount-in-a-shop

Queue

0225-implement-stack-using-queues
0239-sliding-window-maximum
0387-first-unique-character-in-a-string

Counting

0387-first-unique-character-in-a-string
0621-task-scheduler
0920-uncommon-words-from-two-sentences
1227-number-of-equivalent-domino-pairs
1396-count-servers-that-communicate
1708-design-parking-system
1786-count-the-number-of-consistent-strings
1915-check-if-one-string-swap-can-make-strings-equal
2163-kth-distinct-string-in-an-array
2614-maximum-count-of-positive-integer-and-negative-integer

Depth-First Search

0098-validate-binary-search-tree
0133-clone-graph
0200-number-of-islands
0207-course-schedule
0210-course-schedule-ii
0329-longest-increasing-path-in-a-matrix
0449-serialize-and-deserialize-bst
0530-minimum-absolute-difference-in-bst
0695-max-area-of-island
0721-accounts-merge
0733-flood-fill
0744-network-delay-time
0770-couples-holding-hands
0813-all-paths-from-source-to-target
1243-sum-of-nodes-with-even-valued-grandparent
1309-sort-items-by-groups-respecting-dependencies
1396-count-servers-that-communicate
1544-count-good-nodes-in-binary-tree
2347-count-nodes-equal-to-average-of-subtree

Breadth-First Search

0133-clone-graph
0200-number-of-islands
0207-course-schedule
0210-course-schedule-ii
0329-longest-increasing-path-in-a-matrix
0449-serialize-and-deserialize-bst
0530-minimum-absolute-difference-in-bst
0695-max-area-of-island
0721-accounts-merge
0733-flood-fill
0744-network-delay-time
0770-couples-holding-hands
0813-all-paths-from-source-to-target
1036-rotting-oranges
1243-sum-of-nodes-with-even-valued-grandparent
1309-sort-items-by-groups-respecting-dependencies
1396-count-servers-that-communicate
1544-count-good-nodes-in-binary-tree
2375-minimum-obstacle-removal-to-reach-corner

Trie

0139-word-break
0212-word-search-ii
0648-replace-words
3193-maximum-strong-pair-xor-i
3309-count-prefix-and-suffix-pairs-i

Sliding Window

0187-repeated-dna-sequences
0239-sliding-window-maximum
0567-permutation-in-string
2112-minimum-difference-between-highest-and-lowest-of-k-scores
3193-maximum-strong-pair-xor-i
3380-shortest-subarray-with-or-at-least-k-ii

Linked List

0083-remove-duplicates-from-sorted-list

Dynamic Programming

0070-climbing-stairs
0131-palindrome-partitioning
0139-word-break
0329-longest-increasing-path-in-a-matrix
0435-non-overlapping-intervals
0930-all-possible-full-binary-trees
1362-airplane-seat-assignment-probability

Brainteaser

0292-nim-game
0319-bulb-switcher
1362-airplane-seat-assignment-probability

Probability and Statistics

1362-airplane-seat-assignment-probability

Game Theory

0292-nim-game

Recursion

0050-powx-n
0326-power-of-three
0930-all-possible-full-binary-trees

Number Theory

1585-the-kth-factor-of-n
2106-find-greatest-common-divisor-of-array

Enumeration

2122-count-special-quadruplets
2170-count-number-of-maximum-bitwise-or-subsets

Memoization

0070-climbing-stairs
0139-word-break
0329-longest-increasing-path-in-a-matrix
0930-all-possible-full-binary-trees

Two Pointers

0015-3sum
0026-remove-duplicates-from-sorted-array
0283-move-zeroes
0345-reverse-vowels-of-a-string
0567-permutation-in-string
0917-boats-to-save-people
1468-check-if-n-and-its-double-exist
2551-apply-operations-to-an-array
2707-merge-two-2d-arrays-by-summing-values
3471-minimum-average-of-smallest-and-largest-elements

Rolling Hash

0187-repeated-dna-sequences
3309-count-prefix-and-suffix-pairs-i

Hash Function

0187-repeated-dna-sequences
3309-count-prefix-and-suffix-pairs-i

String Matching

0812-rotate-string
1524-string-matching-in-an-array
2292-counting-words-with-a-given-prefix
3309-count-prefix-and-suffix-pairs-i

Prefix Sum

0912-random-pick-with-weight
1537-maximum-score-after-splitting-a-string
1693-sum-of-all-odd-length-subarrays
1895-minimum-number-of-operations-to-move-all-balls-to-each-box

Concurrency

1203-print-in-order
1340-the-dining-philosophers

Union Find

0200-number-of-islands
0695-max-area-of-island
0721-accounts-merge
0770-couples-holding-hands
1396-count-servers-that-communicate

Backtracking

0017-letter-combinations-of-a-phone-number
0039-combination-sum
0040-combination-sum-ii
0047-permutations-ii
0051-n-queens
0077-combinations
0078-subsets
0090-subsets-ii
0093-restore-ip-addresses
0131-palindrome-partitioning
0212-word-search-ii
0813-all-paths-from-source-to-target
2170-count-number-of-maximum-bitwise-or-subsets

Database

0178-rank-scores
0181-employees-earning-more-than-their-managers
0182-duplicate-emails
0183-customers-who-never-order
0184-department-highest-salary
0586-customer-placing-the-largest-number-of-orders
0607-sales-person
1136-actors-and-directors-who-cooperated-at-least-three-times
1174-sales-analysis-iii
1179-game-play-analysis-i
1268-market-analysis-i
1523-capital-gainloss
1541-top-travellers
1734-bank-account-summary-ii
1948-rearrange-products-table
2024-calculate-special-bonus
2041-the-latest-login-in-2020
3530-odd-and-even-transactions
3767-find-students-who-improved
3782-find-valid-emails
3816-dna-pattern-recognition
3848-analyze-subscription-conversion
3865-find-product-recommendation-pairs

Randomized

0912-random-pick-with-weight

Graph

0133-clone-graph
0207-course-schedule
0210-course-schedule-ii
0329-longest-increasing-path-in-a-matrix
0744-network-delay-time
0770-couples-holding-hands
0813-all-paths-from-source-to-target
1309-sort-items-by-groups-respecting-dependencies
1325-path-with-maximum-probability
2375-minimum-obstacle-removal-to-reach-corner

Topological Sort

0207-course-schedule
0210-course-schedule-ii
0329-longest-increasing-path-in-a-matrix
1309-sort-items-by-groups-respecting-dependencies

Shortest Path

0744-network-delay-time
1325-path-with-maximum-probability
2375-minimum-obstacle-removal-to-reach-corner

Monotonic Queue

0239-sliding-window-maximum

Ordered Set

0931-maximum-frequency-stack

Geometry

0830-largest-triangle-area

About

This repository contains solutions for LeetCode Problems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages