Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

646 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 LeetCode & DSA Journey (Striver's A-Z)

This repository serves as a personal archive for my daily problem-solving journey on LeetCode and other competitive programming platforms. It is specifically structured to track my progress through Striver’s A-Z DSA Sheet, focusing on building a deep understanding of complex algorithms and data structures.

📌 Project Overview

  • Objective: To master problem-solving patterns and optimize time/space complexity for technical interviews.
  • Primary Focus: Currently deep-diving into Graphs, Dynamic Programming (DP), Stacks, and Queues.

🛠 Tech Stack

  • Primary Language: C++.
  • Cp Platforms: LeetCode, Codeforces.

📜 Disclaimer

For Educational Purposes Only This repository is a personal log of my journey. The solutions provided here are intended to track my progress and provide a reference for my own learning process.

Academic Integrity These solutions are shared to help the community understand different approaches and logic, not to encourage plagiarism. Please attempt problems independently first.

Optimization Some solutions may not be the most optimal ($O(n)$ vs $O(n^2)$), as they reflect my initial thought process and subsequent improvements during my learning journey.


“Turning data into insights and code into solutions.”

LeetCode Topics

Math

0002-add-two-numbers
0013-roman-to-integer
0070-climbing-stairs
0202-happy-number
0396-rotate-function
0788-rotated-digits
0914-x-of-a-kind-in-a-deck-of-cards
1622-fancy-sequence
1878-get-biggest-three-rhombus-sums-in-a-grid
2591-distribute-money-to-maximum-children
2769-find-the-maximum-achievable-number
2894-divisible-and-non-divisible-sums-difference
2946-matrix-similarity-after-cyclic-shifts
3296-minimum-number-of-seconds-to-make-mountain-height-zero
3464-maximize-the-distance-between-points-on-a-square
3512-minimum-operations-to-make-array-sum-divisible-by-k
3629-minimum-jumps-to-reach-end-via-prime-teleportation
3761-minimum-absolute-distance-between-mirror-pairs
3783-mirror-distance-of-an-integer
3932-count-k-th-roots-in-a-range

Dynamic Programming

0005-longest-palindromic-substring
0044-wildcard-matching
0055-jump-game
0070-climbing-stairs
0087-scramble-string
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0188-best-time-to-buy-and-sell-stock-iv
0198-house-robber
0309-best-time-to-buy-and-sell-stock-with-cooldown
0322-coin-change
0396-rotate-function
0416-partition-equal-subset-sum
0472-concatenated-words
0494-target-sum
0516-longest-palindromic-subsequence
0518-coin-change-ii
0583-delete-operation-for-two-strings
0714-best-time-to-buy-and-sell-stock-with-transaction-fee
0788-rotated-digits
1092-shortest-common-supersequence
1312-minimum-insertion-steps-to-make-a-string-palindrome
1320-minimum-distance-to-type-a-word-using-two-fingers
1594-maximum-non-negative-product-in-a-matrix
1888-minimum-number-of-flips-to-make-the-binary-string-alternating
2463-minimum-total-distance-traveled
2573-find-the-string-with-lcp
2770-maximum-number-of-jumps-to-reach-the-last-index
3129-find-all-possible-stable-binary-arrays-i
3130-find-all-possible-stable-binary-arrays-ii
3225-maximum-score-from-grid-operations
3418-maximum-amount-of-money-robot-can-earn
3660-jump-game-ix
3661-maximum-walls-destroyed-by-robots
3742-maximum-path-score-in-a-grid
3877-minimum-removals-to-achieve-target-xor

Memoization

0070-climbing-stairs

Array

0004-median-of-two-sorted-arrays
0011-container-with-most-water
0031-next-permutation
0036-valid-sudoku
0041-first-missing-positive
0055-jump-game
0088-merge-sorted-array
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0179-largest-number
0188-best-time-to-buy-and-sell-stock-iv
0198-house-robber
0200-number-of-islands
0215-kth-largest-element-in-an-array
0309-best-time-to-buy-and-sell-stock-with-cooldown
0322-coin-change
0347-top-k-frequent-elements
0396-rotate-function
0416-partition-equal-subset-sum
0472-concatenated-words
0485-max-consecutive-ones
0494-target-sum
0518-coin-change-ii
0605-can-place-flowers
0714-best-time-to-buy-and-sell-stock-with-transaction-fee
0904-fruit-into-baskets
0914-x-of-a-kind-in-a-deck-of-cards
0994-rotting-oranges
1391-check-if-there-is-a-valid-path-in-a-grid
1470-shuffle-the-array
1536-minimum-swaps-to-arrange-a-binary-grid
1559-detect-cycles-in-2d-grid
1582-special-positions-in-a-binary-matrix
1594-maximum-non-negative-product-in-a-matrix
1674-minimum-moves-to-make-array-complementary
1727-largest-submatrix-with-rearrangements
1838-frequency-of-the-most-frequent-element
1848-minimum-distance-to-the-target-element
1861-rotating-the-box
1878-get-biggest-three-rhombus-sums-in-a-grid
1886-determine-whether-matrix-can-be-obtained-by-rotation
1909-remove-one-element-to-make-the-array-strictly-increasing
1920-build-array-from-permutation
1929-concatenation-of-array
1980-find-unique-binary-string
2452-words-within-two-edits-of-dictionary
2463-minimum-total-distance-traveled
2515-shortest-distance-to-target-string-in-a-circular-array
2573-find-the-string-with-lcp
2615-sum-of-distances
2760-longest-even-odd-subarray-with-threshold
2770-maximum-number-of-jumps-to-reach-the-last-index
2906-construct-product-matrix
2946-matrix-similarity-after-cyclic-shifts
3070-count-submatrices-with-top-left-element-and-sum-less-than-k
3225-maximum-score-from-grid-operations
3296-minimum-number-of-seconds-to-make-mountain-height-zero
3418-maximum-amount-of-money-robot-can-earn
3464-maximize-the-distance-between-points-on-a-square
3488-closest-equal-element-queries
3512-minimum-operations-to-make-array-sum-divisible-by-k
3546-equal-sum-grid-partition-i
3548-equal-sum-grid-partition-ii
3567-minimum-absolute-difference-in-sliding-submatrix
3629-minimum-jumps-to-reach-end-via-prime-teleportation
3643-flip-square-submatrix-vertically
3653-xor-after-range-multiplication-queries-i
3655-xor-after-range-multiplication-queries-ii
3660-jump-game-ix
3661-maximum-walls-destroyed-by-robots
3668-restore-finishing-order
3740-minimum-distance-between-three-equal-elements-i
3742-maximum-path-score-in-a-grid
3761-minimum-absolute-distance-between-mirror-pairs
3847-find-the-score-difference-in-a-game
3877-minimum-removals-to-achieve-target-xor
3942-minimum-operations-to-sort-a-permutation

Simulation

0657-robot-return-to-origin
1545-find-kth-bit-in-nth-binary-string
1920-build-array-from-permutation
1929-concatenation-of-array
2075-decode-the-slanted-ciphertext
2181-merge-nodes-in-between-zeros
2946-matrix-similarity-after-cyclic-shifts
3582-generate-tag-for-video-caption
3653-xor-after-range-multiplication-queries-i
3847-find-the-score-difference-in-a-game

String

0005-longest-palindromic-substring
0006-zigzag-conversion
0013-roman-to-integer
0044-wildcard-matching
0087-scramble-string
0127-word-ladder
0179-largest-number
0472-concatenated-words
0516-longest-palindromic-subsequence
0583-delete-operation-for-two-strings
0657-robot-return-to-origin
0859-buddy-strings
1092-shortest-common-supersequence
1312-minimum-insertion-steps-to-make-a-string-palindrome
1320-minimum-distance-to-type-a-word-using-two-fingers
1415-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
1545-find-kth-bit-in-nth-binary-string
1689-partitioning-into-minimum-number-of-deci-binary-numbers
1758-minimum-changes-to-make-alternating-binary-string
1784-check-if-binary-string-has-at-most-one-segment-of-ones
1888-minimum-number-of-flips-to-make-the-binary-string-alternating
1980-find-unique-binary-string
2047-number-of-valid-words-in-a-sentence
2075-decode-the-slanted-ciphertext
2423-remove-letter-to-equalize-frequency
2452-words-within-two-edits-of-dictionary
2515-shortest-distance-to-target-string-in-a-circular-array
2573-find-the-string-with-lcp
2833-furthest-point-from-origin
2839-check-if-strings-can-be-made-equal-with-operations-i
3110-score-of-a-string
3407-substring-matching-pattern
3474-lexicographically-smallest-generated-string
3582-generate-tag-for-video-caption
3931-check-adjacent-digit-differences

Greedy

0011-container-with-most-water
0044-wildcard-matching
0055-jump-game
0122-best-time-to-buy-and-sell-stock-ii
0179-largest-number
0605-can-place-flowers
0714-best-time-to-buy-and-sell-stock-with-transaction-fee
1536-minimum-swaps-to-arrange-a-binary-grid
1689-partitioning-into-minimum-number-of-deci-binary-numbers
1727-largest-submatrix-with-rearrangements
1838-frequency-of-the-most-frequent-element
2573-find-the-string-with-lcp
2591-distribute-money-to-maximum-children
3296-minimum-number-of-seconds-to-make-mountain-height-zero
3474-lexicographically-smallest-generated-string
3600-maximize-spanning-tree-stability-with-upgrades

Matrix

0036-valid-sudoku
0200-number-of-islands
0994-rotting-oranges
1391-check-if-there-is-a-valid-path-in-a-grid
1536-minimum-swaps-to-arrange-a-binary-grid
1559-detect-cycles-in-2d-grid
1582-special-positions-in-a-binary-matrix
1594-maximum-non-negative-product-in-a-matrix
1727-largest-submatrix-with-rearrangements
1861-rotating-the-box
1878-get-biggest-three-rhombus-sums-in-a-grid
1886-determine-whether-matrix-can-be-obtained-by-rotation
2573-find-the-string-with-lcp
2906-construct-product-matrix
2946-matrix-similarity-after-cyclic-shifts
3070-count-submatrices-with-top-left-element-and-sum-less-than-k
3225-maximum-score-from-grid-operations
3418-maximum-amount-of-money-robot-can-earn
3546-equal-sum-grid-partition-i
3548-equal-sum-grid-partition-ii
3567-minimum-absolute-difference-in-sliding-submatrix
3643-flip-square-submatrix-vertically
3742-maximum-path-score-in-a-grid

Backtracking

0077-combinations
0494-target-sum
1415-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
1980-find-unique-binary-string

Recursion

0002-add-two-numbers
0025-reverse-nodes-in-k-group
0044-wildcard-matching
1545-find-kth-bit-in-nth-binary-string

Breadth-First Search

0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0127-word-ladder
0200-number-of-islands
0310-minimum-height-trees
0322-coin-change
0662-maximum-width-of-binary-tree
0785-is-graph-bipartite
0994-rotting-oranges
1391-check-if-there-is-a-valid-path-in-a-grid
1559-detect-cycles-in-2d-grid
3629-minimum-jumps-to-reach-end-via-prime-teleportation

Sliding Window

0904-fruit-into-baskets
1838-frequency-of-the-most-frequent-element
1888-minimum-number-of-flips-to-make-the-binary-string-alternating
2760-longest-even-odd-subarray-with-threshold

Hash Table

0013-roman-to-integer
0036-valid-sudoku
0041-first-missing-positive
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0127-word-ladder
0202-happy-number
0347-top-k-frequent-elements
0859-buddy-strings
0904-fruit-into-baskets
0914-x-of-a-kind-in-a-deck-of-cards
1674-minimum-moves-to-make-array-complementary
1980-find-unique-binary-string
2423-remove-letter-to-equalize-frequency
2615-sum-of-distances
3488-closest-equal-element-queries
3548-equal-sum-grid-partition-ii
3629-minimum-jumps-to-reach-end-via-prime-teleportation
3668-restore-finishing-order
3740-minimum-distance-between-three-equal-elements-i
3761-minimum-absolute-distance-between-mirror-pairs

Two Pointers

0005-longest-palindromic-substring
0011-container-with-most-water
0031-next-permutation
0061-rotate-list
0088-merge-sorted-array
0202-happy-number
1861-rotating-the-box
3643-flip-square-submatrix-vertically

Sorting

0088-merge-sorted-array
0179-largest-number
0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
0472-concatenated-words
1727-largest-submatrix-with-rearrangements
1838-frequency-of-the-most-frequent-element
1878-get-biggest-three-rhombus-sums-in-a-grid
2463-minimum-total-distance-traveled
3464-maximize-the-distance-between-points-on-a-square
3567-minimum-absolute-difference-in-sliding-submatrix
3661-maximum-walls-destroyed-by-robots

Prefix Sum

1674-minimum-moves-to-make-array-complementary
1838-frequency-of-the-most-frequent-element
1878-get-biggest-three-rhombus-sums-in-a-grid
2615-sum-of-distances
2906-construct-product-matrix
3070-count-submatrices-with-top-left-element-and-sum-less-than-k
3129-find-all-possible-stable-binary-arrays-i
3130-find-all-possible-stable-binary-arrays-ii
3225-maximum-score-from-grid-operations
3546-equal-sum-grid-partition-i
3548-equal-sum-grid-partition-ii

Bit Manipulation

1009-complement-of-base-10-integer
3877-minimum-removals-to-achieve-target-xor

Binary Search

0004-median-of-two-sorted-arrays
1838-frequency-of-the-most-frequent-element
3296-minimum-number-of-seconds-to-make-mountain-height-zero
3464-maximize-the-distance-between-points-on-a-square
3488-closest-equal-element-queries
3600-maximize-spanning-tree-stability-with-upgrades
3661-maximum-walls-destroyed-by-robots
3932-count-k-th-roots-in-a-range

Union-Find

0200-number-of-islands
0785-is-graph-bipartite
1391-check-if-there-is-a-valid-path-in-a-grid
1559-detect-cycles-in-2d-grid
2573-find-the-string-with-lcp
3600-maximize-spanning-tree-stability-with-upgrades

Graph Theory

0310-minimum-height-trees
0785-is-graph-bipartite
3600-maximize-spanning-tree-stability-with-upgrades

Minimum Spanning Tree

3600-maximize-spanning-tree-stability-with-upgrades

Heap (Priority Queue)

0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
1878-get-biggest-three-rhombus-sums-in-a-grid
3296-minimum-number-of-seconds-to-make-mountain-height-zero

Design

1622-fancy-sequence

Segment Tree

1622-fancy-sequence

Depth-First Search

0094-binary-tree-inorder-traversal
0114-flatten-binary-tree-to-linked-list
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
0200-number-of-islands
0310-minimum-height-trees
0472-concatenated-words
0662-maximum-width-of-binary-tree
0785-is-graph-bipartite
1391-check-if-there-is-a-valid-path-in-a-grid
1559-detect-cycles-in-2d-grid

Topological Sort

0310-minimum-height-trees

Trie

0472-concatenated-words
2452-words-within-two-edits-of-dictionary

Divide and Conquer

0004-median-of-two-sorted-arrays
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
3653-xor-after-range-multiplication-queries-i
3655-xor-after-range-multiplication-queries-ii

Enumeration

3546-equal-sum-grid-partition-i
3548-equal-sum-grid-partition-ii

Linked List

0002-add-two-numbers
0025-reverse-nodes-in-k-group
0061-rotate-list
0114-flatten-binary-tree-to-linked-list
1669-merge-in-between-linked-lists
2181-merge-nodes-in-between-zeros

Counting

0347-top-k-frequent-elements
0914-x-of-a-kind-in-a-deck-of-cards
2423-remove-letter-to-equalize-frequency
2833-furthest-point-from-origin

String Matching

3407-substring-matching-pattern
3474-lexicographically-smallest-generated-string

Number Theory

0914-x-of-a-kind-in-a-deck-of-cards
3629-minimum-jumps-to-reach-end-via-prime-teleportation

Quickselect

0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements

Bucket Sort

0347-top-k-frequent-elements

Geometry

3464-maximize-the-distance-between-points-on-a-square

Stack

0094-binary-tree-inorder-traversal
0114-flatten-binary-tree-to-linked-list
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal

Tree

0094-binary-tree-inorder-traversal
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0114-flatten-binary-tree-to-linked-list
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
0450-delete-node-in-a-bst
0662-maximum-width-of-binary-tree
0701-insert-into-a-binary-search-tree

Binary Tree

0094-binary-tree-inorder-traversal
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0106-construct-binary-tree-from-inorder-and-postorder-traversal
0114-flatten-binary-tree-to-linked-list
0144-binary-tree-preorder-traversal
0145-binary-tree-postorder-traversal
0450-delete-node-in-a-bst
0662-maximum-width-of-binary-tree
0701-insert-into-a-binary-search-tree

Binary Search Tree

0450-delete-node-in-a-bst
0701-insert-into-a-binary-search-tree

Bidirectional Search

0127-word-ladder

About

My daily leetcode solutions

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages