Skip to content

Latest commit

 

History

397 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode DSA


About

This repository contains my accepted solutions to LeetCode problems implemented in C++.

The repository serves as a record of my Data Structures and Algorithms practice, with solutions automatically synchronized using LeetHub. Problems are organized by topic, making it easy to explore different algorithmic patterns and data structures.


Goals

  • Strengthen problem-solving skills
  • Build proficiency in Data Structures and Algorithms
  • Prepare for technical interviews
  • Maintain a consistent coding practice

Tech Stack

Category Technology
Language C++
Platform LeetCode
IDE IntelliJ IDEA
Version Control Git & GitHub

Topics Covered

  • Arrays
  • Strings
  • Hash Tables
  • Linked Lists
  • Stacks
  • Queues
  • Trees
  • Binary Trees
  • Binary Search Trees
  • Graphs
  • Heap / Priority Queue
  • Greedy
  • Sliding Window
  • Two Pointers
  • Prefix Sum
  • Binary Search
  • Dynamic Programming
  • Backtracking
  • Depth First Search
  • Breadth First Search
  • Divide and Conquer
  • Union Find
  • Segment Tree
  • Sorting
  • Counting Sort
  • Memoization
  • Math
  • Combinatorics

Additional topics will be added as the repository grows.


Repository Structure

LeetCode_DSA/
│
├── Problem Name/
│   ├── README.md
│   └── Solution.java
│
├── Problem Name/
│   ├── README.md
│   └── Solution.java
│
└── README.md

The sections below are maintained automatically as new problems are solved and synchronized using LeetHub.

LeetCode Topics

Hash Table

0652-find-duplicate-subtrees
0692-top-k-frequent-words
0947-most-stones-removed-with-same-row-or-column
0987-vertical-order-traversal-of-a-binary-tree
1054-distant-barcodes
1189-maximum-number-of-balloons
1331-rank-transform-of-an-array
1358-number-of-substrings-containing-all-three-characters
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
3020-find-the-maximum-number-of-elements-in-subset
3090-maximum-length-substring-with-two-occurrences
3312-sorted-gcd-pair-queries
3471-find-the-largest-almost-missing-integer
3518-smallest-palindromic-rearrangement-ii
3532-path-existence-queries-in-a-graph-i
3731-find-missing-elements
3737-count-subarrays-with-majority-element-i
3739-count-subarrays-with-majority-element-ii

String

0257-binary-tree-paths
0297-serialize-and-deserialize-binary-tree
0692-top-k-frequent-words
1081-smallest-subsequence-of-distinct-characters
1189-maximum-number-of-balloons
1358-number-of-substrings-containing-all-three-characters
1967-number-of-strings-that-appear-as-substrings-in-word
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
3348-smallest-divisible-digit-product-ii
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

Counting

0692-top-k-frequent-words
1054-distant-barcodes
1189-maximum-number-of-balloons
2029-stone-game-ix
3016-minimum-number-of-pushes-to-type-word-ii
3312-sorted-gcd-pair-queries
3518-smallest-palindromic-rearrangement-ii
3737-count-subarrays-with-majority-element-i

Array

0045-jump-game-ii
0108-convert-sorted-array-to-binary-search-tree
0486-predict-the-winner
0628-maximum-product-of-three-numbers
0692-top-k-frequent-words
0857-minimum-cost-to-hire-k-workers
0877-stone-game
1054-distant-barcodes
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
1563-stone-game-v
1569-number-of-ways-to-reorder-array-to-get-same-bst
1732-find-the-highest-altitude
1760-minimum-limit-of-balls-in-a-bag
1833-maximum-ice-cream-bars
1840-maximum-building-height
1846-maximum-element-after-decreasing-and-rearranging
1967-number-of-strings-that-appear-as-substrings-in-word
1979-find-greatest-common-divisor-of-array
2029-stone-game-ix
2071-maximum-number-of-tasks-you-can-assign
2213-longest-substring-of-one-repeating-character
2574-left-and-right-sum-differences
2812-find-the-safest-path-in-a-grid
2958-length-of-longest-subarray-with-at-most-k-frequency
2996-smallest-missing-integer-greater-than-sequential-prefix-sum
3020-find-the-maximum-number-of-elements-in-subset
3286-find-a-safe-walk-through-a-grid
3312-sorted-gcd-pair-queries
3336-find-the-number-of-subsequences-with-equal-gcd
3471-find-the-largest-almost-missing-integer
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
3620-network-recovery-pathways
3702-longest-subsequence-with-non-zero-bitwise-xor
3731-find-missing-elements
3737-count-subarrays-with-majority-element-i
3739-count-subarrays-with-majority-element-ii
3867-sum-of-gcd-of-formed-pairs

Greedy

0045-jump-game-ii
0857-minimum-cost-to-hire-k-workers
1054-distant-barcodes
1081-smallest-subsequence-of-distinct-characters
1833-maximum-ice-cream-bars
1846-maximum-element-after-decreasing-and-rearranging
2029-stone-game-ix
2071-maximum-number-of-tasks-you-can-assign
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
3534-path-existence-queries-in-a-graph-ii

Sorting

0148-sort-list
0628-maximum-product-of-three-numbers
0692-top-k-frequent-words
0857-minimum-cost-to-hire-k-workers
0987-vertical-order-traversal-of-a-binary-tree
1054-distant-barcodes
1288-remove-covered-intervals
1331-rank-transform-of-an-array
1464-maximum-product-of-two-elements-in-an-array
1833-maximum-ice-cream-bars
1840-maximum-building-height
1846-maximum-element-after-decreasing-and-rearranging
2071-maximum-number-of-tasks-you-can-assign
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

Counting Sort

1833-maximum-ice-cream-bars
3517-smallest-palindromic-rearrangement-i

Depth-First Search

0099-recover-binary-search-tree
0104-maximum-depth-of-binary-tree
0114-flatten-binary-tree-to-linked-list
0235-lowest-common-ancestor-of-a-binary-search-tree
0257-binary-tree-paths
0297-serialize-and-deserialize-binary-tree
0530-minimum-absolute-difference-in-bst
0572-subtree-of-another-tree
0652-find-duplicate-subtrees
0947-most-stones-removed-with-same-row-or-column
0987-vertical-order-traversal-of-a-binary-tree
1373-maximum-sum-bst-in-binary-tree
1530-number-of-good-leaf-nodes-pairs
2492-minimum-score-of-a-path-between-two-cities
2685-count-the-number-of-complete-components
3310-remove-methods-from-project

Union-Find

0947-most-stones-removed-with-same-row-or-column
1569-number-of-ways-to-reorder-array-to-get-same-bst
2492-minimum-score-of-a-path-between-two-cities
2685-count-the-number-of-complete-components
2812-find-the-safest-path-in-a-grid
3532-path-existence-queries-in-a-graph-i

Graph Theory

0947-most-stones-removed-with-same-row-or-column
2492-minimum-score-of-a-path-between-two-cities
2685-count-the-number-of-complete-components
3286-find-a-safe-walk-through-a-grid
3310-remove-methods-from-project
3532-path-existence-queries-in-a-graph-i
3534-path-existence-queries-in-a-graph-ii
3620-network-recovery-pathways

Tree

0099-recover-binary-search-tree
0104-maximum-depth-of-binary-tree
0108-convert-sorted-array-to-binary-search-tree
0114-flatten-binary-tree-to-linked-list
0235-lowest-common-ancestor-of-a-binary-search-tree
0257-binary-tree-paths
0297-serialize-and-deserialize-binary-tree
0530-minimum-absolute-difference-in-bst
0572-subtree-of-another-tree
0652-find-duplicate-subtrees
0987-vertical-order-traversal-of-a-binary-tree
1373-maximum-sum-bst-in-binary-tree
1530-number-of-good-leaf-nodes-pairs
1569-number-of-ways-to-reorder-array-to-get-same-bst

Binary Tree

0099-recover-binary-search-tree
0104-maximum-depth-of-binary-tree
0108-convert-sorted-array-to-binary-search-tree
0114-flatten-binary-tree-to-linked-list
0235-lowest-common-ancestor-of-a-binary-search-tree
0257-binary-tree-paths
0297-serialize-and-deserialize-binary-tree
0530-minimum-absolute-difference-in-bst
0572-subtree-of-another-tree
0652-find-duplicate-subtrees
0987-vertical-order-traversal-of-a-binary-tree
1373-maximum-sum-bst-in-binary-tree
1530-number-of-good-leaf-nodes-pairs
1569-number-of-ways-to-reorder-array-to-get-same-bst

Binary Search Tree

0099-recover-binary-search-tree
0108-convert-sorted-array-to-binary-search-tree
0235-lowest-common-ancestor-of-a-binary-search-tree
0530-minimum-absolute-difference-in-bst
1373-maximum-sum-bst-in-binary-tree
1569-number-of-ways-to-reorder-array-to-get-same-bst
1760-minimum-limit-of-balls-in-a-bag
2071-maximum-number-of-tasks-you-can-assign
2812-find-the-safest-path-in-a-grid
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
3620-network-recovery-pathways

Linked List

0114-flatten-binary-tree-to-linked-list
0148-sort-list
1721-swapping-nodes-in-a-linked-list

Two Pointers

0148-sort-list
1721-swapping-nodes-in-a-linked-list
2071-maximum-number-of-tasks-you-can-assign
3302-find-the-lexicographically-smallest-valid-sequence
3534-path-existence-queries-in-a-graph-ii
3867-sum-of-gcd-of-formed-pairs

Divide and Conquer

0108-convert-sorted-array-to-binary-search-tree
0148-sort-list
1569-number-of-ways-to-reorder-array-to-get-same-bst
3737-count-subarrays-with-majority-element-i
3739-count-subarrays-with-majority-element-ii

Merge Sort

0148-sort-list
3737-count-subarrays-with-majority-element-i
3739-count-subarrays-with-majority-element-ii

Dynamic Programming

0045-jump-game-ii
0486-predict-the-winner
0877-stone-game
1140-stone-game-ii
1301-number-of-paths-with-max-score
1373-maximum-sum-bst-in-binary-tree
1406-stone-game-iii
1510-stone-game-iv
1563-stone-game-v
1569-number-of-ways-to-reorder-array-to-get-same-bst
3302-find-the-lexicographically-smallest-valid-sequence
3336-find-the-number-of-subsequences-with-equal-gcd
3534-path-existence-queries-in-a-graph-ii
3620-network-recovery-pathways
3699-number-of-zigzag-arrays-i
3700-number-of-zigzag-arrays-ii

Prefix Sum

1140-stone-game-ii
1732-find-the-highest-altitude
2574-left-and-right-sum-differences
3312-sorted-gcd-pair-queries
3699-number-of-zigzag-arrays-i
3737-count-subarrays-with-majority-element-i
3739-count-subarrays-with-majority-element-ii
3756-concatenate-non-zero-digits-and-multiply-by-sum-ii

Breadth-First Search

0104-maximum-depth-of-binary-tree
0297-serialize-and-deserialize-binary-tree
0530-minimum-absolute-difference-in-bst
0987-vertical-order-traversal-of-a-binary-tree
2492-minimum-score-of-a-path-between-two-cities
2685-count-the-number-of-complete-components
2812-find-the-safest-path-in-a-grid
3286-find-a-safe-walk-through-a-grid
3310-remove-methods-from-project

Design

0297-serialize-and-deserialize-binary-tree

Math

0007-reverse-integer
0486-predict-the-winner
0628-maximum-product-of-three-numbers
0877-stone-game
1140-stone-game-ii
1406-stone-game-iii
1510-stone-game-iv
1563-stone-game-v
1569-number-of-ways-to-reorder-array-to-get-same-bst
1840-maximum-building-height
1979-find-greatest-common-divisor-of-array
2029-stone-game-ix
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
3348-smallest-divisible-digit-product-ii
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
3700-number-of-zigzag-arrays-ii
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

Segment Tree

2213-longest-substring-of-one-repeating-character
3501-maximize-active-section-with-trade-ii
3737-count-subarrays-with-majority-element-i
3739-count-subarrays-with-majority-element-ii

Memoization

1569-number-of-ways-to-reorder-array-to-get-same-bst

Combinatorics

1569-number-of-ways-to-reorder-array-to-get-same-bst
3312-sorted-gcd-pair-queries
3518-smallest-palindromic-rearrangement-ii

Stack

0114-flatten-binary-tree-to-linked-list
1081-smallest-subsequence-of-distinct-characters

Enumeration

1291-sequential-digits
3020-find-the-maximum-number-of-elements-in-subset
3345-smallest-divisible-digit-product-i
3499-maximize-active-section-with-trade-i
3514-number-of-unique-xor-triplets-ii

Sliding Window

1358-number-of-substrings-containing-all-three-characters
2958-length-of-longest-subarray-with-at-most-k-frequency
3090-maximum-length-substring-with-two-occurrences

Heap (Priority Queue)

0692-top-k-frequent-words
0857-minimum-cost-to-hire-k-workers
1054-distant-barcodes
1464-maximum-product-of-two-elements-in-an-array
2812-find-the-safest-path-in-a-grid
3286-find-a-safe-walk-through-a-grid
3620-network-recovery-pathways

Matrix

1260-shift-2d-grid
1301-number-of-paths-with-max-score
2812-find-the-safest-path-in-a-grid
3286-find-a-safe-walk-through-a-grid

Shortest Path

3286-find-a-safe-walk-through-a-grid
3620-network-recovery-pathways

Topological Sort

3620-network-recovery-pathways

Trie

0692-top-k-frequent-words

Bucket Sort

0692-top-k-frequent-words

Bit Manipulation

3513-number-of-unique-xor-triplets-i
3514-number-of-unique-xor-triplets-ii
3534-path-existence-queries-in-a-graph-ii
3702-longest-subsequence-with-non-zero-bitwise-xor

Number Theory

1979-find-greatest-common-divisor-of-array
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

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

Monotonic Stack

1081-smallest-subsequence-of-distinct-characters

Recursion

0486-predict-the-winner

Game Theory

0486-predict-the-winner
0877-stone-game
1140-stone-game-ii
1406-stone-game-iii
1510-stone-game-iv
1563-stone-game-v
2029-stone-game-ix

String Matching

0572-subtree-of-another-tree

Hash Function

0572-subtree-of-another-tree

Backtracking

0257-binary-tree-paths
3348-smallest-divisible-digit-product-ii

Queue

2071-maximum-number-of-tasks-you-can-assign

Monotonic Queue

2071-maximum-number-of-tasks-you-can-assign

Minimax

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

Zero-Sum Game

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

Nim Game

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

Sprague–Grundy Theorem

1510-stone-game-iv

Ordered Set

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

About

This repository contains my accepted solutions to LeetCode problems implemented in C++. The repository serves as a record of my Data Structures and Algorithms practice, with question and solution. Problems are organized by topic (check ReadMe), making it easy to explore different algorithmic patterns and data structures.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages