Skip to content

avnisinngh/LeetCode_Solution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leetcode_sol

I've been working on solving various challenges on LeetCode, and I'm pleased to share my solutions with you all.

Array

0039-combination-sum
0040-combination-sum-ii
0041-first-missing-positive
0046-permutations
0053-maximum-subarray
0075-sort-colors
0078-subsets
0090-subsets-ii
0152-maximum-product-subarray
0189-rotate-array
0238-product-of-array-except-self
0287-find-the-duplicate-number
0330-patching-array
0442-find-all-duplicates-in-an-array
0502-ipo
0523-continuous-subarray-sum
0525-contiguous-array
0648-replace-words
0713-subarray-product-less-than-k
0853-most-profit-assigning-work
0876-hand-of-straights
0966-binary-subarrays-with-sum
0982-minimum-increment-to-make-array-unique
0985-bag-of-tokens
1016-subarray-sums-divisible-by-k
1019-squares-of-a-sorted-array
1034-subarrays-with-k-different-integers
1037-minimum-number-of-k-consecutive-bit-flips
1044-find-common-characters
1137-height-checker
1138-grumpy-bookstore-owner
1217-relative-sort-array
1407-group-the-people-given-the-group-size-they-belong-to
1482-how-many-numbers-are-smaller-than-the-current-number
1505-create-target-array-in-the-given-order
1528-kids-with-the-greatest-number-of-candies
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
1580-shuffle-the-array
1603-running-sum-of-1d-array
1605-minimum-number-of-days-to-make-m-bouquets
1621-number-of-subsequences-that-satisfy-the-given-sum-condition
1635-number-of-good-pairs
1675-magnetic-force-between-two-balls
1791-richest-customer-wealth
1895-minimum-number-of-operations-to-move-all-balls-to-each-box
2048-build-array-from-permutation
2058-concatenation-of-array
2137-final-value-of-variable-after-performing-operations
2148-minimum-number-of-moves-to-seat-everyone
2219-maximum-number-of-words-found-in-sentences
2324-find-triangular-sum-of-an-array
2524-largest-positive-integer-that-exists-with-its-negative
2527-count-subarrays-with-fixed-bounds
2634-minimum-common-value
2696-the-number-of-beautiful-subsets
2714-left-and-right-sum-differences
2876-number-of-employees-who-met-the-target
2917-count-pairs-whose-sum-is-less-than-target
3194-find-words-containing-character
3225-length-of-longest-subarray-with-at-most-k-frequency
3242-count-elements-with-maximum-frequency
3372-longest-strictly-increasing-or-strictly-decreasing-subarray
3373-maximum-prime-difference
3446-find-the-number-of-good-pairs-i

Hash Table

0041-first-missing-positive
0205-isomorphic-strings
0409-longest-palindrome
0442-find-all-duplicates-in-an-array
0523-continuous-subarray-sum
0525-contiguous-array
0648-replace-words
0807-custom-sort-string
0876-hand-of-straights
0966-binary-subarrays-with-sum
1016-subarray-sums-divisible-by-k
1034-subarrays-with-k-different-integers
1044-find-common-characters
1217-relative-sort-array
1407-group-the-people-given-the-group-size-they-belong-to
1482-how-many-numbers-are-smaller-than-the-current-number
1635-number-of-good-pairs
2524-largest-positive-integer-that-exists-with-its-negative
2634-minimum-common-value
3225-length-of-longest-subarray-with-at-most-k-frequency
3242-count-elements-with-maximum-frequency
3446-find-the-number-of-good-pairs-i

String

0058-length-of-last-word
0205-isomorphic-strings
0344-reverse-string
0409-longest-palindrome
0648-replace-words
0807-custom-sort-string
1044-find-common-characters
1321-get-equal-substrings-within-budget
1666-make-the-string-great
1895-minimum-number-of-operations-to-move-all-balls-to-each-box
2128-reverse-prefix-of-word
2137-final-value-of-variable-after-performing-operations
2219-maximum-number-of-words-found-in-sentences
2572-append-characters-to-string-to-make-subsequence
3055-maximum-odd-binary-number
3194-find-words-containing-character
3361-latest-time-you-can-obtain-after-replacing-characters
3379-score-of-a-string
3451-string-compression-iii

Backtracking

0039-combination-sum
0040-combination-sum-ii
0046-permutations
0078-subsets
0090-subsets-ii
2696-the-number-of-beautiful-subsets

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
0985-bag-of-tokens
1285-balance-a-binary-search-tree
2148-minimum-number-of-moves-to-seat-everyone
2572-append-characters-to-string-to-make-subsequence
3055-maximum-odd-binary-number

Two Pointers

0075-sort-colors
0189-rotate-array
0287-find-the-duplicate-number
0344-reverse-string
0633-sum-of-square-numbers
0853-most-profit-assigning-work
0985-bag-of-tokens
1019-squares-of-a-sorted-array
1621-number-of-subsequences-that-satisfy-the-given-sum-condition
2128-reverse-prefix-of-word
2524-largest-positive-integer-that-exists-with-its-negative
2572-append-characters-to-string-to-make-subsequence
2634-minimum-common-value
2917-count-pairs-whose-sum-is-less-than-target

Binary Search

0287-find-the-duplicate-number
0633-sum-of-square-numbers
0853-most-profit-assigning-work
1321-get-equal-substrings-within-budget
1605-minimum-number-of-days-to-make-m-bouquets
1621-number-of-subsequences-that-satisfy-the-given-sum-condition
1675-magnetic-force-between-two-balls
2634-minimum-common-value
2917-count-pairs-whose-sum-is-less-than-target

Sliding Window

0713-subarray-product-less-than-k
0966-binary-subarrays-with-sum
1034-subarrays-with-k-different-integers
1037-minimum-number-of-k-consecutive-bit-flips
1138-grumpy-bookstore-owner
1321-get-equal-substrings-within-budget
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
2527-count-subarrays-with-fixed-bounds
3225-length-of-longest-subarray-with-at-most-k-frequency

Prefix Sum

0238-product-of-array-except-self
0523-continuous-subarray-sum
0525-contiguous-array
0966-binary-subarrays-with-sum
1016-subarray-sums-divisible-by-k
1037-minimum-number-of-k-consecutive-bit-flips
1321-get-equal-substrings-within-budget
1603-running-sum-of-1d-array
2571-find-the-pivot-integer
2714-left-and-right-sum-differences

Dynamic Programming

0053-maximum-subarray
0152-maximum-product-subarray
1086-divisor-game
1236-n-th-tribonacci-number
2696-the-number-of-beautiful-subsets

Sorting

0075-sort-colors
0502-ipo
0807-custom-sort-string
0853-most-profit-assigning-work
0876-hand-of-straights
0982-minimum-increment-to-make-array-unique
0985-bag-of-tokens
1019-squares-of-a-sorted-array
1137-height-checker
1217-relative-sort-array
1482-how-many-numbers-are-smaller-than-the-current-number
1621-number-of-subsequences-that-satisfy-the-given-sum-condition
1675-magnetic-force-between-two-balls
2148-minimum-number-of-moves-to-seat-everyone
2524-largest-positive-integer-that-exists-with-its-negative
2696-the-number-of-beautiful-subsets
2917-count-pairs-whose-sum-is-less-than-target

Bit Manipulation

0078-subsets
0090-subsets-ii
0287-find-the-duplicate-number
1037-minimum-number-of-k-consecutive-bit-flips

Math

0189-rotate-array
0523-continuous-subarray-sum
0633-sum-of-square-numbers
1086-divisor-game
1236-n-th-tribonacci-number
1635-number-of-good-pairs
2324-find-triangular-sum-of-an-array
2571-find-the-pivot-integer
3055-maximum-odd-binary-number
3373-maximum-prime-difference

Memoization

1236-n-th-tribonacci-number

Divide and Conquer

0053-maximum-subarray
1285-balance-a-binary-search-tree

Number Theory

3373-maximum-prime-difference

Enumeration

3361-latest-time-you-can-obtain-after-replacing-characters

Stack

1666-make-the-string-great

Simulation

1505-create-target-array-in-the-given-order
2048-build-array-from-permutation
2058-concatenation-of-array
2137-final-value-of-variable-after-performing-operations
2324-find-triangular-sum-of-an-array

Combinatorics

2324-find-triangular-sum-of-an-array

Queue

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

Monotonic Queue

1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
2527-count-subarrays-with-fixed-bounds

Counting

1034-subarrays-with-k-different-integers
1482-how-many-numbers-are-smaller-than-the-current-number
1635-number-of-good-pairs
3242-count-elements-with-maximum-frequency

Brainteaser

1086-divisor-game

Game Theory

1086-divisor-game

Matrix

1791-richest-customer-wealth

Trie

0648-replace-words

Counting Sort

0982-minimum-increment-to-make-array-unique
1137-height-checker
1217-relative-sort-array

Heap (Priority Queue)

0502-ipo
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

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

Graph

1916-find-center-of-star-graph

LeetCode Topics

Greedy

0890-lemonade-change
1616-minimum-difference-between-largest-and-smallest-value-in-three-moves
1711-find-valid-matrix-given-row-and-column-sums
1818-maximum-score-from-removing-substrings
2089-maximum-matrix-sum
2095-minimum-number-of-swaps-to-make-the-string-balanced
2379-maximum-total-importance-of-roads
2716-prime-subtraction-operation
3195-separate-black-and-white-balls

Graph

1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph
1701-remove-max-number-of-edges-to-keep-graph-fully-traversable
2379-maximum-total-importance-of-roads
2472-build-a-matrix-with-conditions
3517-shortest-distance-after-road-addition-queries-i

Sorting

0350-intersection-of-two-arrays-ii
0726-number-of-atoms
0948-sort-an-array
1256-rank-transform-of-an-array
1468-check-if-n-and-its-double-exist
1616-minimum-difference-between-largest-and-smallest-value-in-three-moves
2179-most-beautiful-item-for-each-query
2379-maximum-total-importance-of-roads
2554-minimum-total-distance-traveled
2586-longest-square-streak-in-an-array
2699-count-the-number-of-fair-pairs
2846-robot-collisions

Heap (Priority Queue)

0948-sort-an-array
2054-the-number-of-the-smallest-unoccupied-chair
2379-maximum-total-importance-of-roads

Array

0037-sudoku-solver
0046-permutations
0051-n-queens
0350-intersection-of-two-arrays-ii
0787-sliding-puzzle
0890-lemonade-change
0948-sort-an-array
1147-flip-columns-for-maximum-number-of-equal-rows
1256-rank-transform-of-an-array
1293-three-consecutive-odds
1468-check-if-n-and-its-double-exist
1496-lucky-numbers-in-a-matrix
1616-minimum-difference-between-largest-and-smallest-value-in-three-moves
1679-shortest-subarray-to-be-removed-to-make-array-sorted
1711-find-valid-matrix-given-row-and-column-sums
1720-crawler-log-folder
1786-count-the-number-of-consistent-strings
1803-average-waiting-time
1923-sentence-similarity-iii
1940-maximum-xor-for-each-query
1951-find-the-winner-of-the-circular-game
1972-rotating-the-box
2006-find-the-student-that-will-replace-the-chalk
2054-the-number-of-the-smallest-unoccupied-chair
2089-maximum-matrix-sum
2179-most-beautiful-item-for-each-query
2188-minimized-maximum-of-products-distributed-to-any-store
2232-adding-spaces-to-a-string
2356-largest-combination-with-bitwise-and-greater-than-zero
2472-build-a-matrix-with-conditions
2554-minimum-total-distance-traveled
2586-longest-square-streak-in-an-array
2699-count-the-number-of-fair-pairs
2716-prime-subtraction-operation
2794-maximum-number-of-moves-in-a-grid
2846-robot-collisions
3517-shortest-distance-after-road-addition-queries-i
3522-find-the-power-of-k-size-subarrays-i

Backtracking

0037-sudoku-solver
0046-permutations
0051-n-queens
0131-palindrome-partitioning

Depth-First Search

1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph
2217-step-by-step-directions-from-a-binary-tree-node-to-another

Breadth-First Search

0787-sliding-puzzle
1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph
3517-shortest-distance-after-road-addition-queries-i

Topological Sort

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

Hash Table

0037-sudoku-solver
0141-linked-list-cycle
0350-intersection-of-two-arrays-ii
0567-permutation-in-string
0726-number-of-atoms
1147-flip-columns-for-maximum-number-of-equal-rows
1256-rank-transform-of-an-array
1468-check-if-n-and-its-double-exist
1786-count-the-number-of-consistent-strings
2054-the-number-of-the-smallest-unoccupied-chair
2356-largest-combination-with-bitwise-and-greater-than-zero
2586-longest-square-streak-in-an-array

Matrix

0037-sudoku-solver
0787-sliding-puzzle
1147-flip-columns-for-maximum-number-of-equal-rows
1496-lucky-numbers-in-a-matrix
1711-find-valid-matrix-given-row-and-column-sums
1972-rotating-the-box
2089-maximum-matrix-sum
2472-build-a-matrix-with-conditions
2794-maximum-number-of-moves-in-a-grid

Union Find

1701-remove-max-number-of-edges-to-keep-graph-fully-traversable

Two Pointers

0019-remove-nth-node-from-end-of-list
0141-linked-list-cycle
0234-palindrome-linked-list
0350-intersection-of-two-arrays-ii
0567-permutation-in-string
1468-check-if-n-and-its-double-exist
1679-shortest-subarray-to-be-removed-to-make-array-sorted
1923-sentence-similarity-iii
1972-rotating-the-box
2095-minimum-number-of-swaps-to-make-the-string-balanced
2232-adding-spaces-to-a-string
2699-count-the-number-of-fair-pairs
3018-make-string-a-subsequence-using-cyclic-increments
3195-separate-black-and-white-balls

Binary Search

0350-intersection-of-two-arrays-ii
1468-check-if-n-and-its-double-exist
1679-shortest-subarray-to-be-removed-to-make-array-sorted
2006-find-the-student-that-will-replace-the-chalk
2179-most-beautiful-item-for-each-query
2188-minimized-maximum-of-products-distributed-to-any-store
2586-longest-square-streak-in-an-array
2699-count-the-number-of-fair-pairs
2716-prime-subtraction-operation

Linked List

0002-add-two-numbers
0019-remove-nth-node-from-end-of-list
0021-merge-two-sorted-lists
0083-remove-duplicates-from-sorted-list
0141-linked-list-cycle
0203-remove-linked-list-elements
0206-reverse-linked-list
0234-palindrome-linked-list
0328-odd-even-linked-list
2182-find-the-minimum-and-maximum-number-of-nodes-between-critical-points
2299-merge-nodes-in-between-zeros

Simulation

1642-water-bottles
1803-average-waiting-time
1951-find-the-winner-of-the-circular-game
2006-find-the-student-that-will-replace-the-chalk
2076-sum-of-digits-of-string-after-convert
2232-adding-spaces-to-a-string
2299-merge-nodes-in-between-zeros
2645-pass-the-pillow
2800-minimum-string-length-after-removing-substrings
2846-robot-collisions

Math

0002-add-two-numbers
0060-permutation-sequence
1642-water-bottles
1951-find-the-winner-of-the-circular-game
2645-pass-the-pillow
2716-prime-subtraction-operation

String

0131-palindrome-partitioning
0567-permutation-in-string
0726-number-of-atoms
0812-rotate-string
1298-reverse-substrings-between-each-pair-of-parentheses
1302-delete-characters-to-make-fancy-string
1720-crawler-log-folder
1786-count-the-number-of-consistent-strings
1818-maximum-score-from-removing-substrings
1923-sentence-similarity-iii
2076-sum-of-digits-of-string-after-convert
2095-minimum-number-of-swaps-to-make-the-string-balanced
2217-step-by-step-directions-from-a-binary-tree-node-to-another
2232-adding-spaces-to-a-string
2580-circular-sentence
2800-minimum-string-length-after-removing-substrings
3018-make-string-a-subsequence-using-cyclic-increments
3174-minimum-number-of-changes-to-make-binary-string-beautiful
3195-separate-black-and-white-balls
3451-string-compression-iii

Dynamic Programming

0131-palindrome-partitioning
2554-minimum-total-distance-traveled
2586-longest-square-streak-in-an-array
2794-maximum-number-of-moves-in-a-grid

Recursion

0002-add-two-numbers
0021-merge-two-sorted-lists
0060-permutation-sequence
0203-remove-linked-list-elements
0206-reverse-linked-list
0234-palindrome-linked-list
1951-find-the-winner-of-the-circular-game

Queue

1951-find-the-winner-of-the-circular-game

Stack

0234-palindrome-linked-list
0726-number-of-atoms
1298-reverse-substrings-between-each-pair-of-parentheses
1679-shortest-subarray-to-be-removed-to-make-array-sorted
1720-crawler-log-folder
1818-maximum-score-from-removing-substrings
2095-minimum-number-of-swaps-to-make-the-string-balanced
2800-minimum-string-length-after-removing-substrings
2846-robot-collisions

Tree

2217-step-by-step-directions-from-a-binary-tree-node-to-another

Binary Tree

2217-step-by-step-directions-from-a-binary-tree-node-to-another

Divide and Conquer

0948-sort-an-array

Merge Sort

0948-sort-an-array

Bucket Sort

0948-sort-an-array

Radix Sort

0948-sort-an-array

Counting Sort

0948-sort-an-array
1786-count-the-number-of-consistent-strings
2356-largest-combination-with-bitwise-and-greater-than-zero

Prefix Sum

1940-maximum-xor-for-each-query
2006-find-the-student-that-will-replace-the-chalk

Bit Manipulation

1786-count-the-number-of-consistent-strings
1940-maximum-xor-for-each-query
2356-largest-combination-with-bitwise-and-greater-than-zero
3394-minimum-array-end

Sliding Window

0567-permutation-in-string
3522-find-the-power-of-k-size-subarrays-i

String Matching

0812-rotate-string

Number Theory

2716-prime-subtraction-operation

Monotonic Stack

1679-shortest-subarray-to-be-removed-to-make-array-sorted

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages