/Leetcode

My solved Leetcode codes

Primary LanguageC++

My Leetcode Stats :

Leetcode Stats

Leetcode Stats

Two Pointers

0075-sort-colors
0344-reverse-string
0633-sum-of-square-numbers
0853-most-profit-assigning-work
2572-append-characters-to-string-to-make-subsequence

String

0344-reverse-string
0409-longest-palindrome
0648-replace-words
1044-find-common-characters
2572-append-characters-to-string-to-make-subsequence

Greedy

0330-patching-array
0409-longest-palindrome
0502-ipo
0853-most-profit-assigning-work
0876-hand-of-straights
0982-minimum-increment-to-make-array-unique
1285-balance-a-binary-search-tree
2148-minimum-number-of-moves-to-seat-everyone
2379-maximum-total-importance-of-roads
2572-append-characters-to-string-to-make-subsequence

Hash Table

0409-longest-palindrome
0523-continuous-subarray-sum
0648-replace-words
0876-hand-of-straights
1044-find-common-characters

Array

0075-sort-colors
0330-patching-array
0502-ipo
0523-continuous-subarray-sum
0648-replace-words
0853-most-profit-assigning-work
0876-hand-of-straights
0982-minimum-increment-to-make-array-unique
1037-minimum-number-of-k-consecutive-bit-flips
1044-find-common-characters
1138-grumpy-bookstore-owner
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
1605-minimum-number-of-days-to-make-m-bouquets
1675-magnetic-force-between-two-balls
2148-minimum-number-of-moves-to-seat-everyone

Sorting

0075-sort-colors
0502-ipo
0853-most-profit-assigning-work
0876-hand-of-straights
0982-minimum-increment-to-make-array-unique
1675-magnetic-force-between-two-balls
2148-minimum-number-of-moves-to-seat-everyone
2379-maximum-total-importance-of-roads

Trie

0648-replace-words

Math

0523-continuous-subarray-sum
0633-sum-of-square-numbers

Prefix Sum

0523-continuous-subarray-sum
1037-minimum-number-of-k-consecutive-bit-flips

Counting

0982-minimum-increment-to-make-array-unique

Heap (Priority Queue)

0502-ipo
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
2379-maximum-total-importance-of-roads

Binary Search

0633-sum-of-square-numbers
0853-most-profit-assigning-work
1605-minimum-number-of-days-to-make-m-bouquets
1675-magnetic-force-between-two-balls

Sliding Window

1037-minimum-number-of-k-consecutive-bit-flips
1138-grumpy-bookstore-owner
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit

Queue

1037-minimum-number-of-k-consecutive-bit-flips
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit

Ordered Set

1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit

Monotonic Queue

1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit

Bit Manipulation

1037-minimum-number-of-k-consecutive-bit-flips

Tree

1114-binary-search-tree-to-greater-sum-tree
1285-balance-a-binary-search-tree

Depth-First Search

1114-binary-search-tree-to-greater-sum-tree
1285-balance-a-binary-search-tree

Binary Search Tree

1114-binary-search-tree-to-greater-sum-tree
1285-balance-a-binary-search-tree

Binary Tree

1114-binary-search-tree-to-greater-sum-tree
1285-balance-a-binary-search-tree

Divide and Conquer

1285-balance-a-binary-search-tree

Graph

1916-find-center-of-star-graph
2379-maximum-total-importance-of-roads

LeetCode Topics

Depth-First Search

0110-balanced-binary-tree
0199-binary-tree-right-side-view
0200-number-of-islands
0207-course-schedule
0226-invert-binary-tree
0235-lowest-common-ancestor-of-a-binary-search-tree
0337-house-robber-iii
0543-diameter-of-binary-tree
0733-flood-fill
0984-most-stones-removed-with-same-row-or-column
1207-delete-nodes-and-return-forest
1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph

Breadth-First Search

0102-binary-tree-level-order-traversal
0127-word-ladder
0199-binary-tree-right-side-view
0200-number-of-islands
0207-course-schedule
0226-invert-binary-tree
0322-coin-change
0733-flood-fill
1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph
2171-second-minimum-time-to-reach-destination

Graph

0207-course-schedule
0984-most-stones-removed-with-same-row-or-column
1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph
1701-remove-max-number-of-edges-to-keep-graph-fully-traversable
2171-second-minimum-time-to-reach-destination
2472-build-a-matrix-with-conditions

Topological Sort

0207-course-schedule
1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph
2472-build-a-matrix-with-conditions

Array

0001-two-sum
0004-median-of-two-sorted-arrays
0011-container-with-most-water
0015-3sum
0033-search-in-rotated-sorted-array
0034-find-first-and-last-position-of-element-in-sorted-array
0036-valid-sudoku
0037-sudoku-solver
0042-trapping-rain-water
0045-jump-game-ii
0054-spiral-matrix
0075-sort-colors
0079-word-search
0084-largest-rectangle-in-histogram
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0134-gas-station
0139-word-break
0150-evaluate-reverse-polish-notation
0169-majority-element
0198-house-robber
0200-number-of-islands
0221-maximal-square
0283-move-zeroes
0300-longest-increasing-subsequence
0322-coin-change
0350-intersection-of-two-arrays-ii
0416-partition-equal-subset-sum
0621-task-scheduler
0733-flood-fill
0792-binary-search
0912-random-pick-with-weight
1207-delete-nodes-and-return-forest
1293-three-consecutive-odds
1496-lucky-numbers-in-a-matrix
1553-count-triplets-that-can-form-two-arrays-of-equal-xor
1615-range-sum-of-sorted-subarray-sums
1616-minimum-difference-between-largest-and-smallest-value-in-three-moves
1720-crawler-log-folder
1741-sort-array-by-increasing-frequency
1803-average-waiting-time
1951-find-the-winner-of-the-circular-game
2472-build-a-matrix-with-conditions
2502-sort-the-people
2546-number-of-subarrays-with-gcd-equal-to-k
3106-length-of-the-longest-subsequence-that-sums-to-target
3494-minimum-cost-for-cutting-cake-i
3500-minimum-cost-for-cutting-cake-ii
3501-delete-nodes-from-linked-list-present-in-array

Dynamic Programming

0005-longest-palindromic-substring
0010-regular-expression-matching
0042-trapping-rain-water
0045-jump-game-ii
0062-unique-paths
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0139-word-break
0198-house-robber
0221-maximal-square
0300-longest-increasing-subsequence
0322-coin-change
0337-house-robber-iii
0416-partition-equal-subset-sum
0678-valid-parenthesis-string
2562-count-ways-to-build-good-strings
3106-length-of-the-longest-subsequence-that-sums-to-target
3494-minimum-cost-for-cutting-cake-i

Union Find

0200-number-of-islands
0984-most-stones-removed-with-same-row-or-column
1701-remove-max-number-of-edges-to-keep-graph-fully-traversable

Hash Table

0001-two-sum
0012-integer-to-roman
0017-letter-combinations-of-a-phone-number
0036-valid-sudoku
0037-sudoku-solver
0127-word-ladder
0139-word-break
0146-lru-cache
0160-intersection-of-two-linked-lists
0169-majority-element
0202-happy-number
0350-intersection-of-two-arrays-ii
0438-find-all-anagrams-in-a-string
0621-task-scheduler
0726-number-of-atoms
0984-most-stones-removed-with-same-row-or-column
1207-delete-nodes-and-return-forest
1553-count-triplets-that-can-form-two-arrays-of-equal-xor
1741-sort-array-by-increasing-frequency
2502-sort-the-people
3501-delete-nodes-from-linked-list-present-in-array

Two Pointers

0005-longest-palindromic-substring
0011-container-with-most-water
0015-3sum
0042-trapping-rain-water
0075-sort-colors
0125-valid-palindrome
0148-sort-list
0160-intersection-of-two-linked-lists
0202-happy-number
0283-move-zeroes
0295-find-median-from-data-stream
0350-intersection-of-two-arrays-ii
1615-range-sum-of-sorted-subarray-sums

Binary Search

0004-median-of-two-sorted-arrays
0033-search-in-rotated-sorted-array
0034-find-first-and-last-position-of-element-in-sorted-array
0300-longest-increasing-subsequence
0350-intersection-of-two-arrays-ii
0792-binary-search
0912-random-pick-with-weight
1615-range-sum-of-sorted-subarray-sums

Sorting

0015-3sum
0075-sort-colors
0148-sort-list
0169-majority-element
0295-find-median-from-data-stream
0350-intersection-of-two-arrays-ii
0621-task-scheduler
0726-number-of-atoms
1615-range-sum-of-sorted-subarray-sums
1616-minimum-difference-between-largest-and-smallest-value-in-three-moves
1741-sort-array-by-increasing-frequency
2502-sort-the-people
3494-minimum-cost-for-cutting-cake-i
3500-minimum-cost-for-cutting-cake-ii

Greedy

0011-container-with-most-water
0045-jump-game-ii
0122-best-time-to-buy-and-sell-stock-ii
0134-gas-station
0316-remove-duplicate-letters
0621-task-scheduler
0678-valid-parenthesis-string
1616-minimum-difference-between-largest-and-smallest-value-in-three-moves
3494-minimum-cost-for-cutting-cake-i
3500-minimum-cost-for-cutting-cake-ii

Linked List

0002-add-two-numbers
0021-merge-two-sorted-lists
0023-merge-k-sorted-lists
0092-reverse-linked-list-ii
0146-lru-cache
0148-sort-list
0160-intersection-of-two-linked-lists
0206-reverse-linked-list
2299-merge-nodes-in-between-zeros
3501-delete-nodes-from-linked-list-present-in-array

Simulation

0054-spiral-matrix
1642-water-bottles
1803-average-waiting-time
1951-find-the-winner-of-the-circular-game
2299-merge-nodes-in-between-zeros
2645-pass-the-pillow

Math

0002-add-two-numbers
0007-reverse-integer
0012-integer-to-roman
0050-powx-n
0062-unique-paths
0150-evaluate-reverse-polish-notation
0202-happy-number
0912-random-pick-with-weight
1446-angle-between-hands-of-a-clock
1553-count-triplets-that-can-form-two-arrays-of-equal-xor
1642-water-bottles
1951-find-the-winner-of-the-circular-game
2546-number-of-subarrays-with-gcd-equal-to-k
2645-pass-the-pillow

Number Theory

2546-number-of-subarrays-with-gcd-equal-to-k

Recursion

0002-add-two-numbers
0010-regular-expression-matching
0021-merge-two-sorted-lists
0050-powx-n
0206-reverse-linked-list
0394-decode-string
1951-find-the-winner-of-the-circular-game

Queue

0232-implement-queue-using-stacks
1951-find-the-winner-of-the-circular-game

String

0005-longest-palindromic-substring
0008-string-to-integer-atoi
0010-regular-expression-matching
0012-integer-to-roman
0017-letter-combinations-of-a-phone-number
0020-valid-parentheses
0079-word-search
0125-valid-palindrome
0127-word-ladder
0139-word-break
0316-remove-duplicate-letters
0394-decode-string
0438-find-all-anagrams-in-a-string
0678-valid-parenthesis-string
0726-number-of-atoms
1298-reverse-substrings-between-each-pair-of-parentheses
1720-crawler-log-folder
2502-sort-the-people

Stack

0020-valid-parentheses
0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0150-evaluate-reverse-polish-notation
0155-min-stack
0232-implement-queue-using-stacks
0316-remove-duplicate-letters
0394-decode-string
0678-valid-parenthesis-string
0726-number-of-atoms
1298-reverse-substrings-between-each-pair-of-parentheses
1720-crawler-log-folder

Tree

0102-binary-tree-level-order-traversal
0110-balanced-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0235-lowest-common-ancestor-of-a-binary-search-tree
0337-house-robber-iii
0543-diameter-of-binary-tree
1207-delete-nodes-and-return-forest

Binary Tree

0102-binary-tree-level-order-traversal
0110-balanced-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0235-lowest-common-ancestor-of-a-binary-search-tree
0337-house-robber-iii
0543-diameter-of-binary-tree
1207-delete-nodes-and-return-forest

Matrix

0036-valid-sudoku
0037-sudoku-solver
0054-spiral-matrix
0079-word-search
0200-number-of-islands
0221-maximal-square
0733-flood-fill
1496-lucky-numbers-in-a-matrix
2472-build-a-matrix-with-conditions

Bit Manipulation

1553-count-triplets-that-can-form-two-arrays-of-equal-xor

Prefix Sum

0912-random-pick-with-weight
1553-count-triplets-that-can-form-two-arrays-of-equal-xor

Binary Search Tree

0235-lowest-common-ancestor-of-a-binary-search-tree

Design

0146-lru-cache
0155-min-stack
0232-implement-queue-using-stacks
0295-find-median-from-data-stream

Divide and Conquer

0004-median-of-two-sorted-arrays
0023-merge-k-sorted-lists
0148-sort-list
0169-majority-element

Counting

0169-majority-element
0621-task-scheduler

Shortest Path

2171-second-minimum-time-to-reach-destination

Backtracking

0017-letter-combinations-of-a-phone-number
0037-sudoku-solver
0079-word-search

Sliding Window

0438-find-all-anagrams-in-a-string

Heap (Priority Queue)

0023-merge-k-sorted-lists
0295-find-median-from-data-stream
0621-task-scheduler

Doubly-Linked List

0146-lru-cache

Combinatorics

0062-unique-paths

Trie

0139-word-break

Memoization

0139-word-break

Randomized

0912-random-pick-with-weight

Merge Sort

0023-merge-k-sorted-lists
0148-sort-list

Data Stream

0295-find-median-from-data-stream

Monotonic Stack

0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0316-remove-duplicate-letters