Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

874 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leetcode_Problems

A collection of LeetCode questions!

LeetCode Topics

Array

0001-two-sum
0004-median-of-two-sorted-arrays
0011-container-with-most-water
0014-longest-common-prefix
0015-3sum
0026-remove-duplicates-from-sorted-array
0027-remove-element
0033-search-in-rotated-sorted-array
0035-search-insert-position
0042-trapping-rain-water
0045-jump-game-ii
0049-group-anagrams
0053-maximum-subarray
0055-jump-game
0063-unique-paths-ii
0064-minimum-path-sum
0066-plus-one
0068-text-justification
0074-search-a-2d-matrix
0075-sort-colors
0078-subsets
0080-remove-duplicates-from-sorted-array-ii
0088-merge-sorted-array
0090-subsets-ii
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0120-triangle
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0123-best-time-to-buy-and-sell-stock-iii
0128-longest-consecutive-sequence
0130-surrounded-regions
0134-gas-station
0135-candy
0136-single-number
0137-single-number-ii
0139-word-break
0149-max-points-on-a-line
0162-find-peak-element
0167-two-sum-ii-input-array-is-sorted
0169-majority-element
0188-best-time-to-buy-and-sell-stock-iv
0189-rotate-array
0198-house-robber
0200-number-of-islands
0209-minimum-size-subarray-sum
0238-product-of-array-except-self
0239-sliding-window-maximum
0260-single-number-iii
0274-h-index
0300-longest-increasing-subsequence
0309-best-time-to-buy-and-sell-stock-with-cooldown
0322-coin-change
0380-insert-delete-getrandom-o1
0399-evaluate-division
0486-predict-the-winner
0532-k-diff-pairs-in-an-array
0621-task-scheduler
0628-maximum-product-of-three-numbers
0877-stone-game
1140-stone-game-ii
1260-shift-2d-grid
1288-remove-covered-intervals
1301-number-of-paths-with-max-score
1331-rank-transform-of-an-array
1406-stone-game-iii
1464-maximum-product-of-two-elements-in-an-array
1979-find-greatest-common-divisor-of-array
2213-longest-substring-of-one-repeating-character
2958-length-of-longest-subarray-with-at-most-k-frequency
2996-smallest-missing-integer-greater-than-sequential-prefix-sum
3312-sorted-gcd-pair-queries
3336-find-the-number-of-subsequences-with-equal-gcd
3501-maximize-active-section-with-trade-ii
3513-number-of-unique-xor-triplets-i
3514-number-of-unique-xor-triplets-ii
3532-path-existence-queries-in-a-graph-i
3534-path-existence-queries-in-a-graph-ii
3731-find-missing-elements
3867-sum-of-gcd-of-formed-pairs

Dynamic Programming

0042-trapping-rain-water
0045-jump-game-ii
0053-maximum-subarray
0055-jump-game
0063-unique-paths-ii
0064-minimum-path-sum
0070-climbing-stairs
0120-triangle
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0123-best-time-to-buy-and-sell-stock-iii
0139-word-break
0188-best-time-to-buy-and-sell-stock-iv
0198-house-robber
0300-longest-increasing-subsequence
0309-best-time-to-buy-and-sell-stock-with-cooldown
0322-coin-change
0392-is-subsequence
0486-predict-the-winner
0877-stone-game
1140-stone-game-ii
1143-longest-common-subsequence
1301-number-of-paths-with-max-score
1406-stone-game-iii
3302-find-the-lexicographically-smallest-valid-sequence
3336-find-the-number-of-subsequences-with-equal-gcd
3534-path-existence-queries-in-a-graph-ii

Matrix

0063-unique-paths-ii
0064-minimum-path-sum
0074-search-a-2d-matrix
0130-surrounded-regions
0200-number-of-islands
1260-shift-2d-grid
1301-number-of-paths-with-max-score

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0012-integer-to-roman
0013-roman-to-integer
0049-group-anagrams
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0128-longest-consecutive-sequence
0133-clone-graph
0139-word-break
0141-linked-list-cycle
0149-max-points-on-a-line
0169-majority-element
0202-happy-number
0380-insert-delete-getrandom-o1
0532-k-diff-pairs-in-an-array
0621-task-scheduler
1331-rank-transform-of-an-array
2958-length-of-longest-subarray-with-at-most-k-frequency
2996-smallest-missing-integer-greater-than-sequential-prefix-sum
3016-minimum-number-of-pushes-to-type-word-ii
3090-maximum-length-substring-with-two-occurrences
3312-sorted-gcd-pair-queries
3518-smallest-palindromic-rearrangement-ii
3532-path-existence-queries-in-a-graph-i
3731-find-missing-elements

Two Pointers

0011-container-with-most-water
0015-3sum
0026-remove-duplicates-from-sorted-array
0027-remove-element
0028-find-the-index-of-the-first-occurrence-in-a-string
0042-trapping-rain-water
0075-sort-colors
0080-remove-duplicates-from-sorted-array-ii
0088-merge-sorted-array
0125-valid-palindrome
0141-linked-list-cycle
0151-reverse-words-in-a-string
0167-two-sum-ii-input-array-is-sorted
0189-rotate-array
0202-happy-number
0392-is-subsequence
0532-k-diff-pairs-in-an-array
3302-find-the-lexicographically-smallest-valid-sequence
3534-path-existence-queries-in-a-graph-ii
3867-sum-of-gcd-of-formed-pairs

Greedy

0011-container-with-most-water
0045-jump-game-ii
0055-jump-game
0122-best-time-to-buy-and-sell-stock-ii
0134-gas-station
0135-candy
0621-task-scheduler
1081-smallest-subsequence-of-distinct-characters
3014-minimum-number-of-pushes-to-type-word-i
3016-minimum-number-of-pushes-to-type-word-ii
3302-find-the-lexicographically-smallest-valid-sequence
3534-path-existence-queries-in-a-graph-ii

Prefix Sum

0209-minimum-size-subarray-sum
0238-product-of-array-except-self
1140-stone-game-ii
3312-sorted-gcd-pair-queries
3756-concatenate-non-zero-digits-and-multiply-by-sum-ii

Union-Find

0128-longest-consecutive-sequence
0130-surrounded-regions
0200-number-of-islands
0399-evaluate-division
2685-count-the-number-of-complete-components
3532-path-existence-queries-in-a-graph-i

String

0003-longest-substring-without-repeating-characters
0006-zigzag-conversion
0012-integer-to-roman
0013-roman-to-integer
0014-longest-common-prefix
0020-valid-parentheses
0028-find-the-index-of-the-first-occurrence-in-a-string
0049-group-anagrams
0058-length-of-last-word
0068-text-justification
0125-valid-palindrome
0139-word-break
0151-reverse-words-in-a-string
0392-is-subsequence
0399-evaluate-division
0520-detect-capital
1081-smallest-subsequence-of-distinct-characters
1143-longest-common-subsequence
2213-longest-substring-of-one-repeating-character
3014-minimum-number-of-pushes-to-type-word-i
3016-minimum-number-of-pushes-to-type-word-ii
3090-maximum-length-substring-with-two-occurrences
3302-find-the-lexicographically-smallest-valid-sequence
3499-maximize-active-section-with-trade-i
3501-maximize-active-section-with-trade-ii
3517-smallest-palindromic-rearrangement-i
3518-smallest-palindromic-rearrangement-ii
3756-concatenate-non-zero-digits-and-multiply-by-sum-ii

Sorting

0015-3sum
0049-group-anagrams
0075-sort-colors
0088-merge-sorted-array
0169-majority-element
0274-h-index
0532-k-diff-pairs-in-an-array
0621-task-scheduler
0628-maximum-product-of-three-numbers
1288-remove-covered-intervals
1331-rank-transform-of-an-array
1464-maximum-product-of-two-elements-in-an-array
2996-smallest-missing-integer-greater-than-sequential-prefix-sum
3016-minimum-number-of-pushes-to-type-word-ii
3517-smallest-palindromic-rearrangement-i
3534-path-existence-queries-in-a-graph-ii
3536-maximum-product-of-two-digits
3731-find-missing-elements
3867-sum-of-gcd-of-formed-pairs

Stack

0020-valid-parentheses
0042-trapping-rain-water
0114-flatten-binary-tree-to-linked-list
1081-smallest-subsequence-of-distinct-characters

Monotonic Stack

0042-trapping-rain-water
1081-smallest-subsequence-of-distinct-characters

Math

0002-add-two-numbers
0012-integer-to-roman
0013-roman-to-integer
0029-divide-two-integers
0050-powx-n
0066-plus-one
0069-sqrtx
0070-climbing-stairs
0149-max-points-on-a-line
0172-factorial-trailing-zeroes
0189-rotate-array
0202-happy-number
0380-insert-delete-getrandom-o1
0486-predict-the-winner
0628-maximum-product-of-three-numbers
0877-stone-game
1140-stone-game-ii
1406-stone-game-iii
1979-find-greatest-common-divisor-of-array
3014-minimum-number-of-pushes-to-type-word-i
3312-sorted-gcd-pair-queries
3336-find-the-number-of-subsequences-with-equal-gcd
3345-smallest-divisible-digit-product-i
3513-number-of-unique-xor-triplets-i
3514-number-of-unique-xor-triplets-ii
3518-smallest-palindromic-rearrangement-ii
3536-maximum-product-of-two-digits
3658-gcd-of-odd-and-even-sums
3754-concatenate-non-zero-digits-and-multiply-by-sum-i
3756-concatenate-non-zero-digits-and-multiply-by-sum-ii
3867-sum-of-gcd-of-formed-pairs

Binary Search

0004-median-of-two-sorted-arrays
0033-search-in-rotated-sorted-array
0035-search-insert-position
0069-sqrtx
0074-search-a-2d-matrix
0162-find-peak-element
0167-two-sum-ii-input-array-is-sorted
0209-minimum-size-subarray-sum
0300-longest-increasing-subsequence
0532-k-diff-pairs-in-an-array
3312-sorted-gcd-pair-queries
3501-maximize-active-section-with-trade-ii
3532-path-existence-queries-in-a-graph-i
3534-path-existence-queries-in-a-graph-ii

Divide and Conquer

0004-median-of-two-sorted-arrays
0053-maximum-subarray
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0169-majority-element

Breadth-First Search

0100-same-tree
0101-symmetric-tree
0104-maximum-depth-of-binary-tree
0112-path-sum
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0130-surrounded-regions
0133-clone-graph
0200-number-of-islands
0207-course-schedule
0210-course-schedule-ii
0226-invert-binary-tree
0322-coin-change
0399-evaluate-division
2685-count-the-number-of-complete-components
3310-remove-methods-from-project

Graph Theory

0133-clone-graph
0207-course-schedule
0210-course-schedule-ii
0399-evaluate-division
2685-count-the-number-of-complete-components
3310-remove-methods-from-project
3532-path-existence-queries-in-a-graph-i
3534-path-existence-queries-in-a-graph-ii

Bit Manipulation

0029-divide-two-integers
0078-subsets
0090-subsets-ii
0136-single-number
0137-single-number-ii
0260-single-number-iii
2220-minimum-bit-flips-to-convert-number
3513-number-of-unique-xor-triplets-i
3514-number-of-unique-xor-triplets-ii
3534-path-existence-queries-in-a-graph-ii

Depth-First Search

0100-same-tree
0101-symmetric-tree
0104-maximum-depth-of-binary-tree
0112-path-sum
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0130-surrounded-regions
0133-clone-graph
0200-number-of-islands
0207-course-schedule
0210-course-schedule-ii
0226-invert-binary-tree
0399-evaluate-division
2685-count-the-number-of-complete-components
3310-remove-methods-from-project

Queue

0239-sliding-window-maximum

Sliding Window

0003-longest-substring-without-repeating-characters
0209-minimum-size-subarray-sum
0239-sliding-window-maximum
2958-length-of-longest-subarray-with-at-most-k-frequency
3090-maximum-length-substring-with-two-occurrences

Heap (Priority Queue)

0239-sliding-window-maximum
0621-task-scheduler
1464-maximum-product-of-two-elements-in-an-array

Monotonic Queue

0239-sliding-window-maximum

Enumeration

1291-sequential-digits
3345-smallest-divisible-digit-product-i
3499-maximize-active-section-with-trade-i
3514-number-of-unique-xor-triplets-ii

Backtracking

0078-subsets
0090-subsets-ii

Number Theory

1979-find-greatest-common-divisor-of-array
3312-sorted-gcd-pair-queries
3336-find-the-number-of-subsequences-with-equal-gcd
3658-gcd-of-odd-and-even-sums
3867-sum-of-gcd-of-formed-pairs

Simulation

0068-text-justification
1260-shift-2d-grid
3867-sum-of-gcd-of-formed-pairs

Topological Sort

0207-course-schedule
0210-course-schedule-ii

Counting

0169-majority-element
0621-task-scheduler
3016-minimum-number-of-pushes-to-type-word-ii
3312-sorted-gcd-pair-queries
3518-smallest-palindromic-rearrangement-ii

Combinatorics

3312-sorted-gcd-pair-queries
3518-smallest-palindromic-rearrangement-ii

Segment Tree

2213-longest-substring-of-one-repeating-character
3501-maximize-active-section-with-trade-ii

Recursion

0002-add-two-numbers
0021-merge-two-sorted-lists
0050-powx-n
0486-predict-the-winner

Geometry

0149-max-points-on-a-line

Linked List

0002-add-two-numbers
0021-merge-two-sorted-lists
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0141-linked-list-cycle

Counting Sort

0274-h-index
3517-smallest-palindromic-rearrangement-i

Design

0380-insert-delete-getrandom-o1

Randomized

0380-insert-delete-getrandom-o1

Shortest Path

0399-evaluate-division

Tree

0100-same-tree
0101-symmetric-tree
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0112-path-sum
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0226-invert-binary-tree

Binary Tree

0100-same-tree
0101-symmetric-tree
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0112-path-sum
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0226-invert-binary-tree

Game Theory

0486-predict-the-winner
0877-stone-game
1140-stone-game-ii
1406-stone-game-iii

Trie

0014-longest-common-prefix
0139-word-break

Minimax

1140-stone-game-ii

Zero-Sum Game

1140-stone-game-ii

Database

0197-rising-temperature
0570-managers-with-at-least-5-direct-reports
0577-employee-bonus
0584-find-customer-referee
0595-big-countries
0620-not-boring-movies
1068-product-sales-analysis-i
1075-project-employees-i
1148-article-views-i
1193-monthly-transactions-i
1211-queries-quality-and-percentage
1251-average-selling-price
1280-students-and-examinations
1378-replace-employee-id-with-the-unique-identifier
1581-customer-who-visited-but-did-not-make-any-transactions
1633-percentage-of-users-attended-a-contest
1661-average-time-of-process-per-machine
1683-invalid-tweets
1757-recyclable-and-low-fat-products
1934-confirmation-rate

Bracket Sequences

0020-valid-parentheses

Quicksort

0075-sort-colors

Bubble Sort

0075-sort-colors

Memoization

0070-climbing-stairs
0139-word-break

Brute-Force Search

0139-word-break

Knapsack Problem

0322-coin-change

Complete Knapsack

0322-coin-change

Longest Increasing Subsequence

0300-longest-increasing-subsequence

Ordered Set

2213-longest-substring-of-one-repeating-character

String Matching

0028-find-the-index-of-the-first-occurrence-in-a-string

Z Algorithm

0028-find-the-index-of-the-first-occurrence-in-a-string

Knuth–Morris–Pratt Algorithm

0028-find-the-index-of-the-first-occurrence-in-a-string

Boyer–Moore String-Search Algorithm

0028-find-the-index-of-the-first-occurrence-in-a-string

About

A repository of LeetCode solutions. Organized for easy reference and practice.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages