Kkarthikshet.com
Open source · Learning

LeetCode Solutions

LeetCode solutions, mainly in Java, covering arrays, strings, trees, graphs, dynamic programming and more for DSA and interview practice.

GitHub starsLast commit

Welcome to my LeetCode solutions repository!

This repository contains my solutions to LeetCode problems solved as part of my Data Structures & Algorithms (DSA) practice and Software Engineering interview preparation. The solutions are primarily implemented in Java and cover a wide range of topics including arrays, strings, linked lists, trees, graphs, dynamic programming, greedy algorithms, and more.

🎯 Objectives

  • Strengthen problem-solving and analytical thinking skills
  • Master Data Structures and Algorithms
  • Prepare for Software Development Engineer (SDE) interviews
  • Build consistency through daily coding practice
  • Track learning progress over time

🛠️ Tech Stack

  • Java
  • Data Structures & Algorithms
  • LeetCode Platform
  • Git & GitHub
  • LeetHub v2 (Automatic Solution Sync)

📚 Topics Covered

  • Arrays & Strings
  • Linked Lists
  • Stacks & Queues
  • Hash Tables
  • Trees & Binary Trees
  • Binary Search Trees
  • Heaps & Priority Queues
  • Graphs
  • Recursion & Backtracking
  • Dynamic Programming
  • Greedy Algorithms
  • Sliding Window
  • Two Pointers
  • Binary Search
  • Bit Manipulation
  • Sorting & Searching

📈 Progress

I continuously update this repository as I solve new problems and improve my understanding of algorithms and data structures.

🔗 Profiles

⭐ Note

This repository serves as a personal learning archive and interview preparation resource. Solutions may include multiple approaches with varying time and space complexities where applicable.

Happy Coding! 🚀

LeetCode Topics

Array

0001-two-sum
0004-median-of-two-sorted-arrays
0011-container-with-most-water
0014-longest-common-prefix
0015-3sum
0016-3sum-closest
0018-4sum
0026-remove-duplicates-from-sorted-array
0027-remove-element
0031-next-permutation
0033-search-in-rotated-sorted-array
0034-find-first-and-last-position-of-element-in-sorted-array
0035-search-insert-position
0036-valid-sudoku
0037-sudoku-solver
0039-combination-sum
0040-combination-sum-ii
0041-first-missing-positive
0042-trapping-rain-water
0045-jump-game-ii
0047-permutations-ii
0048-rotate-image
0049-group-anagrams
0051-n-queens
0053-maximum-subarray
0054-spiral-matrix
0055-jump-game
0056-merge-intervals
0057-insert-interval
0059-spiral-matrix-ii
0063-unique-paths-ii
0064-minimum-path-sum
0066-plus-one
0068-text-justification
0073-set-matrix-zeroes
0074-search-a-2d-matrix
0075-sort-colors
0078-subsets
0079-word-search
0080-remove-duplicates-from-sorted-array-ii
0081-search-in-rotated-sorted-array-ii
0084-largest-rectangle-in-histogram
0085-maximal-rectangle
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
0108-convert-sorted-array-to-binary-search-tree
0118-pascals-triangle
0119-pascals-triangle-ii
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
0150-evaluate-reverse-polish-notation
0152-maximum-product-subarray
0153-find-minimum-in-rotated-sorted-array
0154-find-minimum-in-rotated-sorted-array-ii
0162-find-peak-element
0164-maximum-gap
0167-two-sum-ii-input-array-is-sorted
0169-majority-element
0174-dungeon-game
0179-largest-number
0188-best-time-to-buy-and-sell-stock-iv
0189-rotate-array
0200-number-of-islands
0217-contains-duplicate
0239-sliding-window-maximum
0260-single-number-iii
0268-missing-number
0274-h-index
0275-h-index-ii
0283-move-zeroes
0284-peeking-iterator
0287-find-the-duplicate-number
0289-game-of-life
0300-longest-increasing-subsequence
0303-range-sum-query-immutable
0304-range-sum-query-2d-immutable
0307-range-sum-query-mutable
0309-best-time-to-buy-and-sell-stock-with-cooldown
0324-wiggle-sort-ii
0329-longest-increasing-path-in-a-matrix
0330-patching-array
0332-reconstruct-itinerary
0354-russian-doll-envelopes
0378-kth-smallest-element-in-a-sorted-matrix
0391-perfect-rectangle
0396-rotate-function
0486-predict-the-winner
0628-maximum-product-of-three-numbers
0875-koko-eating-bananas
0877-stone-game
0904-fruit-into-baskets
1140-stone-game-ii
1260-shift-2d-grid
1288-remove-covered-intervals
1301-number-of-paths-with-max-score
1386-cinema-seat-allocation
1406-stone-game-iii
1464-maximum-product-of-two-elements-in-an-array
1563-stone-game-v
1658-minimum-operations-to-reduce-x-to-zero
1752-check-if-array-is-sorted-and-rotated
1861-rotating-the-box
1872-stone-game-viii
1886-determine-whether-matrix-can-be-obtained-by-rotation
1979-find-greatest-common-divisor-of-array
2029-stone-game-ix
2091-removing-minimum-and-maximum-from-array
2126-destroying-asteroids
2144-minimum-cost-of-buying-candies-with-discount
2213-longest-substring-of-one-repeating-character
2812-find-the-safest-path-in-a-grid
2946-matrix-similarity-after-cyclic-shifts
2948-make-lexicographically-smallest-array-by-swapping-elements
2958-length-of-longest-subarray-with-at-most-k-frequency
2996-smallest-missing-integer-greater-than-sequential-prefix-sum
3069-distribute-elements-into-two-arrays-i
3116-kth-smallest-amount-with-single-denomination-combination
3312-sorted-gcd-pair-queries
3336-find-the-number-of-subsequences-with-equal-gcd
3413-maximum-coins-from-k-consecutive-bags
3501-maximize-active-section-with-trade-ii
3514-number-of-unique-xor-triplets-ii
3532-path-existence-queries-in-a-graph-i
3534-path-existence-queries-in-a-graph-ii
3568-minimum-moves-to-clean-the-classroom
3643-flip-square-submatrix-vertically
3702-longest-subsequence-with-non-zero-bitwise-xor
3718-smallest-missing-multiple-of-k
3731-find-missing-elements
3867-sum-of-gcd-of-formed-pairs
3875-construct-uniform-parity-array-i
3876-construct-uniform-parity-array-ii
3903-smallest-stable-index-i
3904-smallest-stable-index-ii

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
0035-search-insert-position
0069-sqrtx
0074-search-a-2d-matrix
0081-search-in-rotated-sorted-array-ii
0153-find-minimum-in-rotated-sorted-array
0154-find-minimum-in-rotated-sorted-array-ii
0162-find-peak-element
0167-two-sum-ii-input-array-is-sorted
0268-missing-number
0275-h-index-ii
0278-first-bad-version
0287-find-the-duplicate-number
0300-longest-increasing-subsequence
0354-russian-doll-envelopes
0367-valid-perfect-square
0374-guess-number-higher-or-lower
0378-kth-smallest-element-in-a-sorted-matrix
0875-koko-eating-bananas
1658-minimum-operations-to-reduce-x-to-zero
2812-find-the-safest-path-in-a-grid
3116-kth-smallest-amount-with-single-denomination-combination
3312-sorted-gcd-pair-queries
3413-maximum-coins-from-k-consecutive-bags
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
0023-merge-k-sorted-lists
0053-maximum-subarray
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0108-convert-sorted-array-to-binary-search-tree
0109-convert-sorted-list-to-binary-search-tree
0148-sort-list
0169-majority-element
0190-reverse-bits
0191-number-of-1-bits
0307-range-sum-query-mutable
0324-wiggle-sort-ii

Two Pointers

0005-longest-palindromic-substring
0011-container-with-most-water
0015-3sum
0016-3sum-closest
0018-4sum
0019-remove-nth-node-from-end-of-list
0026-remove-duplicates-from-sorted-array
0027-remove-element
0028-find-the-index-of-the-first-occurrence-in-a-string
0031-next-permutation
0042-trapping-rain-water
0061-rotate-list
0075-sort-colors
0080-remove-duplicates-from-sorted-array-ii
0082-remove-duplicates-from-sorted-list-ii
0086-partition-list
0088-merge-sorted-array
0125-valid-palindrome
0141-linked-list-cycle
0142-linked-list-cycle-ii
0143-reorder-list
0148-sort-list
0151-reverse-words-in-a-string
0160-intersection-of-two-linked-lists
0165-compare-version-numbers
0167-two-sum-ii-input-array-is-sorted
0189-rotate-array
0202-happy-number
0283-move-zeroes
0287-find-the-duplicate-number
0295-find-median-from-data-stream
0392-is-subsequence
1861-rotating-the-box
3302-find-the-lexicographically-smallest-valid-sequence
3534-path-existence-queries-in-a-graph-ii
3643-flip-square-submatrix-vertically
3734-lexicographically-smallest-palindromic-permutation-greater-than-target
3867-sum-of-gcd-of-formed-pairs

String

0005-longest-palindromic-substring
0006-zigzag-conversion
0008-string-to-integer-atoi
0010-regular-expression-matching
0012-integer-to-roman
0013-roman-to-integer
0014-longest-common-prefix
0017-letter-combinations-of-a-phone-number
0020-valid-parentheses
0022-generate-parentheses
0028-find-the-index-of-the-first-occurrence-in-a-string
0030-substring-with-concatenation-of-all-words
0032-longest-valid-parentheses
0038-count-and-say
0043-multiply-strings
0044-wildcard-matching
0049-group-anagrams
0058-length-of-last-word
0065-valid-number
0067-add-binary
0068-text-justification
0071-simplify-path
0072-edit-distance
0076-minimum-window-substring
0079-word-search
0087-scramble-string
0091-decode-ways
0093-restore-ip-addresses
0097-interleaving-string
0115-distinct-subsequences
0125-valid-palindrome
0126-word-ladder-ii
0127-word-ladder
0131-palindrome-partitioning
0132-palindrome-partitioning-ii
0139-word-break
0151-reverse-words-in-a-string
0165-compare-version-numbers
0166-fraction-to-recurring-decimal
0168-excel-sheet-column-title
0171-excel-sheet-column-number
0179-largest-number
0205-isomorphic-strings
0211-design-add-and-search-words-data-structure
0227-basic-calculator-ii
0242-valid-anagram
0257-binary-tree-paths
0273-integer-to-english-words
0282-expression-add-operators
0290-word-pattern
0297-serialize-and-deserialize-binary-tree
0299-bulls-and-cows
0301-remove-invalid-parentheses
0306-additive-number
0332-reconstruct-itinerary
0387-first-unique-character-in-a-string
0389-find-the-difference
0392-is-subsequence
0767-reorganize-string
0796-rotate-string
0940-distinct-subsequences-ii
1190-reverse-substrings-between-each-pair-of-parentheses
1758-minimum-changes-to-make-alternating-binary-string
1927-sum-game
2213-longest-substring-of-one-repeating-character
2904-shortest-and-lexicographically-smallest-beautiful-string
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
3348-smallest-divisible-digit-product-ii
3499-maximize-active-section-with-trade-i
3501-maximize-active-section-with-trade-ii
3666-minimum-operations-to-equalize-binary-string
3720-lexicographically-smallest-permutation-greater-than-target
3734-lexicographically-smallest-palindromic-permutation-greater-than-target
3756-concatenate-non-zero-digits-and-multiply-by-sum-ii

Dynamic Programming

0005-longest-palindromic-substring
0010-regular-expression-matching
0022-generate-parentheses
0032-longest-valid-parentheses
0042-trapping-rain-water
0044-wildcard-matching
0045-jump-game-ii
0053-maximum-subarray
0055-jump-game
0062-unique-paths
0063-unique-paths-ii
0064-minimum-path-sum
0070-climbing-stairs
0072-edit-distance
0085-maximal-rectangle
0087-scramble-string
0091-decode-ways
0095-unique-binary-search-trees-ii
0096-unique-binary-search-trees
0097-interleaving-string
0115-distinct-subsequences
0118-pascals-triangle
0119-pascals-triangle-ii
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
0124-binary-tree-maximum-path-sum
0131-palindrome-partitioning
0132-palindrome-partitioning-ii
0139-word-break
0152-maximum-product-subarray
0174-dungeon-game
0188-best-time-to-buy-and-sell-stock-iv
0233-number-of-digit-one
0264-ugly-number-ii
0279-perfect-squares
0300-longest-increasing-subsequence
0309-best-time-to-buy-and-sell-stock-with-cooldown
0329-longest-increasing-path-in-a-matrix
0338-counting-bits
0354-russian-doll-envelopes
0392-is-subsequence
0396-rotate-function
0486-predict-the-winner
0788-rotated-digits
0877-stone-game
0940-distinct-subsequences-ii
1140-stone-game-ii
1301-number-of-paths-with-max-score
1406-stone-game-iii
1510-stone-game-iv
1563-stone-game-v
1872-stone-game-viii
3130-find-all-possible-stable-binary-arrays-ii
3302-find-the-lexicographically-smallest-valid-sequence
3336-find-the-number-of-subsequences-with-equal-gcd
3534-path-existence-queries-in-a-graph-ii

Math

0007-reverse-integer
0009-palindrome-number
0012-integer-to-roman
0013-roman-to-integer
0029-divide-two-integers
0043-multiply-strings
0048-rotate-image
0050-powx-n
0060-permutation-sequence
0062-unique-paths
0066-plus-one
0067-add-binary
0069-sqrtx
0070-climbing-stairs
0089-gray-code
0096-unique-binary-search-trees
0149-max-points-on-a-line
0150-evaluate-reverse-polish-notation
0166-fraction-to-recurring-decimal
0168-excel-sheet-column-title
0171-excel-sheet-column-number
0172-factorial-trailing-zeroes
0189-rotate-array
0202-happy-number
0227-basic-calculator-ii
0233-number-of-digit-one
0258-add-digits
0263-ugly-number
0264-ugly-number-ii
0268-missing-number
0273-integer-to-english-words
0279-perfect-squares
0282-expression-add-operators
0292-nim-game
0326-power-of-three
0367-valid-perfect-square
0391-perfect-rectangle
0396-rotate-function
0486-predict-the-winner
0628-maximum-product-of-three-numbers
0788-rotated-digits
0877-stone-game
1140-stone-game-ii
1406-stone-game-iii
1510-stone-game-iv
1563-stone-game-v
1622-fancy-sequence
1872-stone-game-viii
1927-sum-game
1979-find-greatest-common-divisor-of-array
2029-stone-game-ix
2946-matrix-similarity-after-cyclic-shifts
3014-minimum-number-of-pushes-to-type-word-i
3116-kth-smallest-amount-with-single-denomination-combination
3312-sorted-gcd-pair-queries
3336-find-the-number-of-subsequences-with-equal-gcd
3345-smallest-divisible-digit-product-i
3348-smallest-divisible-digit-product-ii
3514-number-of-unique-xor-triplets-ii
3536-maximum-product-of-two-digits
3622-check-divisibility-by-digit-sum-and-product
3658-gcd-of-odd-and-even-sums
3666-minimum-operations-to-equalize-binary-string
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
3871-count-commas-in-range-ii
3875-construct-uniform-parity-array-i
3876-construct-uniform-parity-array-ii

Recursion

0010-regular-expression-matching
0021-merge-two-sorted-lists
0025-reverse-nodes-in-k-group
0044-wildcard-matching
0050-powx-n
0060-permutation-sequence
0143-reorder-list
0203-remove-linked-list-elements
0206-reverse-linked-list
0233-number-of-digit-one
0273-integer-to-english-words
0326-power-of-three
0486-predict-the-winner

Greedy

0011-container-with-most-water
0044-wildcard-matching
0045-jump-game-ii
0055-jump-game
0122-best-time-to-buy-and-sell-stock-ii
0134-gas-station
0135-candy
0179-largest-number
0324-wiggle-sort-ii
0330-patching-array
0767-reorganize-string
1386-cinema-seat-allocation
1927-sum-game
2029-stone-game-ix
2091-removing-minimum-and-maximum-from-array
2126-destroying-asteroids
2144-minimum-cost-of-buying-candies-with-discount
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
3348-smallest-divisible-digit-product-ii
3413-maximum-coins-from-k-consecutive-bags
3534-path-existence-queries-in-a-graph-ii
3720-lexicographically-smallest-permutation-greater-than-target

Hash Table

0001-two-sum
0012-integer-to-roman
0013-roman-to-integer
0017-letter-combinations-of-a-phone-number
0030-substring-with-concatenation-of-all-words
0036-valid-sudoku
0037-sudoku-solver
0041-first-missing-positive
0049-group-anagrams
0073-set-matrix-zeroes
0076-minimum-window-substring
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0126-word-ladder-ii
0127-word-ladder
0128-longest-consecutive-sequence
0133-clone-graph
0138-copy-list-with-random-pointer
0139-word-break
0141-linked-list-cycle
0142-linked-list-cycle-ii
0146-lru-cache
0149-max-points-on-a-line
0160-intersection-of-two-linked-lists
0166-fraction-to-recurring-decimal
0169-majority-element
0202-happy-number
0205-isomorphic-strings
0217-contains-duplicate
0242-valid-anagram
0264-ugly-number-ii
0268-missing-number
0290-word-pattern
0299-bulls-and-cows
0355-design-twitter
0387-first-unique-character-in-a-string
0389-find-the-difference
0391-perfect-rectangle
0767-reorganize-string
0904-fruit-into-baskets
1386-cinema-seat-allocation
1658-minimum-operations-to-reduce-x-to-zero
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
3532-path-existence-queries-in-a-graph-i
3568-minimum-moves-to-clean-the-classroom
3718-smallest-missing-multiple-of-k
3720-lexicographically-smallest-permutation-greater-than-target
3731-find-missing-elements

Trie

0014-longest-common-prefix
0139-word-break
0211-design-add-and-search-words-data-structure

Sorting

0015-3sum
0016-3sum-closest
0018-4sum
0047-permutations-ii
0049-group-anagrams
0056-merge-intervals
0075-sort-colors
0088-merge-sorted-array
0147-insertion-sort-list
0148-sort-list
0164-maximum-gap
0169-majority-element
0179-largest-number
0217-contains-duplicate
0242-valid-anagram
0268-missing-number
0274-h-index
0295-find-median-from-data-stream
0324-wiggle-sort-ii
0332-reconstruct-itinerary
0354-russian-doll-envelopes
0378-kth-smallest-element-in-a-sorted-matrix
0389-find-the-difference
0628-maximum-product-of-three-numbers
0767-reorganize-string
1288-remove-covered-intervals
1464-maximum-product-of-two-elements-in-an-array
2126-destroying-asteroids
2144-minimum-cost-of-buying-candies-with-discount
2948-make-lexicographically-smallest-array-by-swapping-elements
2996-smallest-missing-integer-greater-than-sequential-prefix-sum
3016-minimum-number-of-pushes-to-type-word-ii
3413-maximum-coins-from-k-consecutive-bags
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

Backtracking

0017-letter-combinations-of-a-phone-number
0022-generate-parentheses
0037-sudoku-solver
0039-combination-sum
0040-combination-sum-ii
0047-permutations-ii
0051-n-queens
0052-n-queens-ii
0077-combinations
0078-subsets
0079-word-search
0089-gray-code
0090-subsets-ii
0093-restore-ip-addresses
0095-unique-binary-search-trees-ii
0113-path-sum-ii
0126-word-ladder-ii
0131-palindrome-partitioning
0257-binary-tree-paths
0282-expression-add-operators
0301-remove-invalid-parentheses
0306-additive-number
3348-smallest-divisible-digit-product-ii

Linked List

0019-remove-nth-node-from-end-of-list
0021-merge-two-sorted-lists
0023-merge-k-sorted-lists
0025-reverse-nodes-in-k-group
0061-rotate-list
0082-remove-duplicates-from-sorted-list-ii
0083-remove-duplicates-from-sorted-list
0086-partition-list
0092-reverse-linked-list-ii
0109-convert-sorted-list-to-binary-search-tree
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0138-copy-list-with-random-pointer
0141-linked-list-cycle
0142-linked-list-cycle-ii
0143-reorder-list
0146-lru-cache
0147-insertion-sort-list
0148-sort-list
0160-intersection-of-two-linked-lists
0203-remove-linked-list-elements
0206-reverse-linked-list
0328-odd-even-linked-list
0355-design-twitter
2058-find-the-minimum-and-maximum-number-of-nodes-between-critical-points

Heap (Priority Queue)

0023-merge-k-sorted-lists
0239-sliding-window-maximum
0264-ugly-number-ii
0295-find-median-from-data-stream
0332-reconstruct-itinerary
0355-design-twitter
0378-kth-smallest-element-in-a-sorted-matrix
0767-reorganize-string
1464-maximum-product-of-two-elements-in-an-array
2812-find-the-safest-path-in-a-grid

Merge Sort

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

Depth-First Search

0079-word-search
0094-binary-tree-inorder-traversal
0098-validate-binary-search-tree
0099-recover-binary-search-tree
0100-same-tree
0101-symmetric-tree
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0111-minimum-depth-of-binary-tree
0112-path-sum
0113-path-sum-ii
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
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
0200-number-of-islands
0207-course-schedule
0211-design-add-and-search-words-data-structure
0226-invert-binary-tree
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0257-binary-tree-paths
0297-serialize-and-deserialize-binary-tree
0329-longest-increasing-path-in-a-matrix
0332-reconstruct-itinerary
0404-sum-of-left-leaves
0783-minimum-distance-between-bst-nodes
2265-count-nodes-equal-to-average-of-subtree
2492-minimum-score-of-a-path-between-two-cities
2685-count-the-number-of-complete-components
3310-remove-methods-from-project

Breadth-First Search

0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0107-binary-tree-level-order-traversal-ii
0111-minimum-depth-of-binary-tree
0112-path-sum
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0126-word-ladder-ii
0127-word-ladder
0130-surrounded-regions
0133-clone-graph
0200-number-of-islands
0207-course-schedule
0226-invert-binary-tree
0279-perfect-squares
0297-serialize-and-deserialize-binary-tree
0301-remove-invalid-parentheses
0329-longest-increasing-path-in-a-matrix
0404-sum-of-left-leaves
0783-minimum-distance-between-bst-nodes
2492-minimum-score-of-a-path-between-two-cities
2685-count-the-number-of-complete-components
2812-find-the-safest-path-in-a-grid
3310-remove-methods-from-project
3568-minimum-moves-to-clean-the-classroom
3666-minimum-operations-to-equalize-binary-string

Union-Find

0128-longest-consecutive-sequence
0130-surrounded-regions
0200-number-of-islands
2492-minimum-score-of-a-path-between-two-cities
2685-count-the-number-of-complete-components
2812-find-the-safest-path-in-a-grid
2948-make-lexicographically-smallest-array-by-swapping-elements
3532-path-existence-queries-in-a-graph-i
3666-minimum-operations-to-equalize-binary-string

Matrix

0036-valid-sudoku
0037-sudoku-solver
0048-rotate-image
0054-spiral-matrix
0059-spiral-matrix-ii
0063-unique-paths-ii
0064-minimum-path-sum
0073-set-matrix-zeroes
0074-search-a-2d-matrix
0079-word-search
0085-maximal-rectangle
0130-surrounded-regions
0174-dungeon-game
0200-number-of-islands
0289-game-of-life
0304-range-sum-query-2d-immutable
0329-longest-increasing-path-in-a-matrix
0378-kth-smallest-element-in-a-sorted-matrix
1260-shift-2d-grid
1301-number-of-paths-with-max-score
1861-rotating-the-box
1886-determine-whether-matrix-can-be-obtained-by-rotation
2812-find-the-safest-path-in-a-grid
2946-matrix-similarity-after-cyclic-shifts
3568-minimum-moves-to-clean-the-classroom
3643-flip-square-submatrix-vertically

Design

0146-lru-cache
0155-min-stack
0173-binary-search-tree-iterator
0211-design-add-and-search-words-data-structure
0225-implement-stack-using-queues
0232-implement-queue-using-stacks
0284-peeking-iterator
0295-find-median-from-data-stream
0297-serialize-and-deserialize-binary-tree
0303-range-sum-query-immutable
0304-range-sum-query-2d-immutable
0307-range-sum-query-mutable
0355-design-twitter
1622-fancy-sequence

Doubly-Linked List

0146-lru-cache

Prefix Sum

0303-range-sum-query-immutable
0304-range-sum-query-2d-immutable
1140-stone-game-ii
1658-minimum-operations-to-reduce-x-to-zero
1872-stone-game-viii
3130-find-all-possible-stable-binary-arrays-ii
3312-sorted-gcd-pair-queries
3413-maximum-coins-from-k-consecutive-bags
3756-concatenate-non-zero-digits-and-multiply-by-sum-ii
3903-smallest-stable-index-i
3904-smallest-stable-index-ii

Graph Theory

0133-clone-graph
0207-course-schedule
0329-longest-increasing-path-in-a-matrix
0332-reconstruct-itinerary
2492-minimum-score-of-a-path-between-two-cities
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
0067-add-binary
0078-subsets
0089-gray-code
0090-subsets-ii
0136-single-number
0137-single-number-ii
0190-reverse-bits
0191-number-of-1-bits
0260-single-number-iii
0268-missing-number
0287-find-the-duplicate-number
0338-counting-bits
0389-find-the-difference
1386-cinema-seat-allocation
3116-kth-smallest-amount-with-single-denomination-combination
3514-number-of-unique-xor-triplets-ii
3534-path-existence-queries-in-a-graph-ii
3568-minimum-moves-to-clean-the-classroom
3702-longest-subsequence-with-non-zero-bitwise-xor

Stack

0020-valid-parentheses
0032-longest-valid-parentheses
0042-trapping-rain-water
0071-simplify-path
0084-largest-rectangle-in-histogram
0085-maximal-rectangle
0094-binary-tree-inorder-traversal
0114-flatten-binary-tree-to-linked-list
0143-reorder-list
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
0150-evaluate-reverse-polish-notation
0155-min-stack
0173-binary-search-tree-iterator
0225-implement-stack-using-queues
0227-basic-calculator-ii
0232-implement-queue-using-stacks
1190-reverse-substrings-between-each-pair-of-parentheses

Enumeration

1291-sequential-digits
3345-smallest-divisible-digit-product-i
3499-maximize-active-section-with-trade-i
3514-number-of-unique-xor-triplets-ii
3720-lexicographically-smallest-permutation-greater-than-target
3734-lexicographically-smallest-palindromic-permutation-greater-than-target

Number Theory

0258-add-digits
1622-fancy-sequence
1979-find-greatest-common-divisor-of-array
3116-kth-smallest-amount-with-single-denomination-combination
3312-sorted-gcd-pair-queries
3336-find-the-number-of-subsequences-with-equal-gcd
3348-smallest-divisible-digit-product-ii
3658-gcd-of-odd-and-even-sums
3867-sum-of-gcd-of-formed-pairs

Simulation

0043-multiply-strings
0054-spiral-matrix
0059-spiral-matrix-ii
0067-add-binary
0068-text-justification
0258-add-digits
0289-game-of-life
1260-shift-2d-grid
2946-matrix-similarity-after-cyclic-shifts
3069-distribute-elements-into-two-arrays-i
3867-sum-of-gcd-of-formed-pairs

Combinatorics

0062-unique-paths
3116-kth-smallest-amount-with-single-denomination-combination
3312-sorted-gcd-pair-queries

Counting

0169-majority-element
0299-bulls-and-cows
0387-first-unique-character-in-a-string
0767-reorganize-string
2029-stone-game-ix
3016-minimum-number-of-pushes-to-type-word-ii
3312-sorted-gcd-pair-queries
3720-lexicographically-smallest-permutation-greater-than-target

Tree

0094-binary-tree-inorder-traversal
0095-unique-binary-search-trees-ii
0096-unique-binary-search-trees
0098-validate-binary-search-tree
0099-recover-binary-search-tree
0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0107-binary-tree-level-order-traversal-ii
0108-convert-sorted-array-to-binary-search-tree
0109-convert-sorted-list-to-binary-search-tree
0110-balanced-binary-tree
0111-minimum-depth-of-binary-tree
0112-path-sum
0113-path-sum-ii
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0124-binary-tree-maximum-path-sum
0129-sum-root-to-leaf-numbers
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
0173-binary-search-tree-iterator
0226-invert-binary-tree
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0257-binary-tree-paths
0297-serialize-and-deserialize-binary-tree
0404-sum-of-left-leaves
0783-minimum-distance-between-bst-nodes
2265-count-nodes-equal-to-average-of-subtree

Binary Tree

0094-binary-tree-inorder-traversal
0095-unique-binary-search-trees-ii
0096-unique-binary-search-trees
0098-validate-binary-search-tree
0099-recover-binary-search-tree
0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0107-binary-tree-level-order-traversal-ii
0108-convert-sorted-array-to-binary-search-tree
0109-convert-sorted-list-to-binary-search-tree
0110-balanced-binary-tree
0111-minimum-depth-of-binary-tree
0112-path-sum
0113-path-sum-ii
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0117-populating-next-right-pointers-in-each-node-ii
0124-binary-tree-maximum-path-sum
0129-sum-root-to-leaf-numbers
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
0173-binary-search-tree-iterator
0226-invert-binary-tree
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0257-binary-tree-paths
0297-serialize-and-deserialize-binary-tree
0404-sum-of-left-leaves
0783-minimum-distance-between-bst-nodes
2265-count-nodes-equal-to-average-of-subtree

Memoization

0070-climbing-stairs
0139-word-break
0329-longest-increasing-path-in-a-matrix

Segment Tree

0307-range-sum-query-mutable
1622-fancy-sequence
2213-longest-substring-of-one-repeating-character
3501-maximize-active-section-with-trade-ii

String Matching

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

Sliding Window

0030-substring-with-concatenation-of-all-words
0076-minimum-window-substring
0239-sliding-window-maximum
0904-fruit-into-baskets
1658-minimum-operations-to-reduce-x-to-zero
2904-shortest-and-lexicographically-smallest-beautiful-string
2958-length-of-longest-subarray-with-at-most-k-frequency
3090-maximum-length-substring-with-two-occurrences
3413-maximum-coins-from-k-consecutive-bags

Binary Search Tree

0095-unique-binary-search-trees-ii
0096-unique-binary-search-trees
0098-validate-binary-search-tree
0099-recover-binary-search-tree
0108-convert-sorted-array-to-binary-search-tree
0109-convert-sorted-list-to-binary-search-tree
0173-binary-search-tree-iterator
0235-lowest-common-ancestor-of-a-binary-search-tree
0783-minimum-distance-between-bst-nodes

Monotonic Stack

0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0085-maximal-rectangle

Database

0175-combine-two-tables
0176-second-highest-salary
0177-nth-highest-salary
0178-rank-scores
0180-consecutive-numbers
0181-employees-earning-more-than-their-managers
0182-duplicate-emails
0183-customers-who-never-order
0184-department-highest-salary
0185-department-top-three-salaries
0262-trips-and-users

Iterator

0173-binary-search-tree-iterator
0284-peeking-iterator

Ordered Set

2213-longest-substring-of-one-repeating-character
3666-minimum-operations-to-equalize-binary-string

Geometry

0149-max-points-on-a-line
0391-perfect-rectangle

Bucket Sort

0164-maximum-gap

Radix Sort

0164-maximum-gap

Game Theory

0292-nim-game
0486-predict-the-winner
0877-stone-game
1140-stone-game-ii
1406-stone-game-iii
1510-stone-game-iv
1563-stone-game-v
1872-stone-game-viii
1927-sum-game
2029-stone-game-ix

Interactive

0278-first-bad-version
0374-guess-number-higher-or-lower

Brainteaser

0292-nim-game

Counting Sort

0274-h-index

Data Stream

0295-find-median-from-data-stream

Topological Sort

0207-course-schedule
0329-longest-increasing-path-in-a-matrix

Sweep Line

0391-perfect-rectangle

Eulerian Circuit

0332-reconstruct-itinerary

Binary Indexed Tree

0307-range-sum-query-mutable

Quickselect

0324-wiggle-sort-ii

Minimax

1140-stone-game-ii
1406-stone-game-iii
1510-stone-game-iv
1872-stone-game-viii
2029-stone-game-ix

Zero-Sum Game

1140-stone-game-ii
1406-stone-game-iii
1510-stone-game-iv
1872-stone-game-viii
2029-stone-game-ix

Directed Acyclic Graph

0329-longest-increasing-path-in-a-matrix

Binary Lifting

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

Lowest Common Ancestor

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

Queue

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

Monotonic Queue

0239-sliding-window-maximum

Range Minimum/Maximum Query

0239-sliding-window-maximum

Floyd's Cycle Finding Algorithm

0202-happy-number

Nim Game

1510-stone-game-iv
2029-stone-game-ix

Sprague–Grundy Theorem

1510-stone-game-iv

Bracket Sequences

1190-reverse-substrings-between-each-pair-of-parentheses