Skip to content

Collection of LeetCode questions to ace the coding interview!

Notifications You must be signed in to change notification settings

bhanupgpt/leetcode-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leetcode-practice

Collection of LeetCode questions to practice for a coding interview!

Array

0853-most-profit-assigning-work
1138-grumpy-bookstore-owner
1370-count-number-of-nice-subarrays
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit
1605-minimum-number-of-days-to-make-m-bouquets
1675-magnetic-force-between-two-balls

Two Pointers

0853-most-profit-assigning-work

Binary Search

0853-most-profit-assigning-work
1605-minimum-number-of-days-to-make-m-bouquets
1675-magnetic-force-between-two-balls

Greedy

0853-most-profit-assigning-work
1285-balance-a-binary-search-tree

Sorting

0853-most-profit-assigning-work
1675-magnetic-force-between-two-balls

Sliding Window

1138-grumpy-bookstore-owner
1370-count-number-of-nice-subarrays
1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit

Hash Table

1370-count-number-of-nice-subarrays

Math

1370-count-number-of-nice-subarrays

Queue

1549-longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit

Heap (Priority Queue)

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

Monotonic Queue

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

Divide and Conquer

1285-balance-a-binary-search-tree

Graph

1916-find-center-of-star-graph

LeetCode Topics

Greedy

0179-largest-number
0890-lemonade-change
1616-minimum-difference-between-largest-and-smallest-value-in-three-moves
1766-minimum-number-of-removals-to-make-mountain-array
1818-maximum-score-from-removing-substrings
2379-maximum-total-importance-of-roads
2616-maximal-score-after-applying-k-operations
2716-prime-subtraction-operation

Graph

0984-most-stones-removed-with-same-row-or-column
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
2803-modify-graph-edge-weights

Sorting

0179-largest-number
0350-intersection-of-two-arrays-ii
0539-minimum-time-difference
0719-find-k-th-smallest-pair-distance
0726-number-of-atoms
1256-rank-transform-of-an-array
1616-minimum-difference-between-largest-and-smallest-value-in-three-moves
2379-maximum-total-importance-of-roads
2554-minimum-total-distance-traveled
2695-find-score-of-an-array-after-marking-all-elements
3291-find-if-array-can-be-sorted

Heap (Priority Queue)

0264-ugly-number-ii
0789-kth-largest-element-in-a-stream
2379-maximum-total-importance-of-roads
2616-maximal-score-after-applying-k-operations
2695-find-score-of-an-array-after-marking-all-elements
2803-modify-graph-edge-weights

Depth-First Search

0145-binary-tree-postorder-traversal
0386-lexicographical-numbers
0776-n-ary-tree-postorder-traversal
0984-most-stones-removed-with-same-row-or-column
1207-delete-nodes-and-return-forest
1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph
1653-number-of-good-leaf-nodes-pairs
2035-count-sub-islands
2217-step-by-step-directions-from-a-binary-tree-node-to-another

Breadth-First Search

1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph
2035-count-sub-islands

Topological Sort

1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph

Union Find

0984-most-stones-removed-with-same-row-or-column
1701-remove-max-number-of-edges-to-keep-graph-fully-traversable
2035-count-sub-islands

Array

0039-combination-sum
0040-combination-sum-ii
0053-maximum-subarray
0167-two-sum-ii-input-array-is-sorted
0179-largest-number
0350-intersection-of-two-arrays-ii
0539-minimum-time-difference
0719-find-k-th-smallest-pair-distance
0729-my-calendar-i
0731-my-calendar-ii
0859-design-circular-deque
0890-lemonade-change
1207-delete-nodes-and-return-forest
1240-stone-game-ii
1256-rank-transform-of-an-array
1293-three-consecutive-odds
1435-xor-queries-of-a-subarray
1496-lucky-numbers-in-a-matrix
1497-design-a-stack-with-increment-operation
1616-minimum-difference-between-largest-and-smallest-value-in-three-moves
1694-make-sum-divisible-by-p
1720-crawler-log-folder
1766-minimum-number-of-removals-to-make-mountain-array
1786-count-the-number-of-consistent-strings
1803-average-waiting-time
2006-find-the-student-that-will-replace-the-chalk
2035-count-sub-islands
2067-maximum-number-of-points-with-cost
2155-find-missing-observations
2306-create-binary-tree-from-descriptions
2411-spiral-matrix-iv
2494-sum-of-prefix-scores-of-strings
2503-longest-subarray-with-maximum-bitwise-and
2554-minimum-total-distance-traveled
2616-maximal-score-after-applying-k-operations
2695-find-score-of-an-array-after-marking-all-elements
2716-prime-subtraction-operation
2794-maximum-number-of-moves-in-a-grid
3291-find-if-array-can-be-sorted
3329-find-the-length-of-the-longest-common-prefix
3501-delete-nodes-from-linked-list-present-in-array

Hash Table

0264-ugly-number-ii
0350-intersection-of-two-arrays-ii
0432-all-oone-data-structure
0726-number-of-atoms
0920-uncommon-words-from-two-sentences
0984-most-stones-removed-with-same-row-or-column
1207-delete-nodes-and-return-forest
1256-rank-transform-of-an-array
1473-find-the-longest-substring-containing-vowels-in-even-counts
1694-make-sum-divisible-by-p
1786-count-the-number-of-consistent-strings
2306-create-binary-tree-from-descriptions
2695-find-score-of-an-array-after-marking-all-elements
3329-find-the-length-of-the-longest-common-prefix
3501-delete-nodes-from-linked-list-present-in-array

Two Pointers

0167-two-sum-ii-input-array-is-sorted
0350-intersection-of-two-arrays-ii
0719-find-k-th-smallest-pair-distance

Binary Search

0167-two-sum-ii-input-array-is-sorted
0350-intersection-of-two-arrays-ii
0719-find-k-th-smallest-pair-distance
0729-my-calendar-i
0731-my-calendar-ii
1766-minimum-number-of-removals-to-make-mountain-array
2006-find-the-student-that-will-replace-the-chalk
2716-prime-subtraction-operation

Linked List

0002-add-two-numbers
0432-all-oone-data-structure
0725-split-linked-list-in-parts
0859-design-circular-deque
2182-find-the-minimum-and-maximum-number-of-nodes-between-critical-points
2299-merge-nodes-in-between-zeros
2411-spiral-matrix-iv
2903-insert-greatest-common-divisors-in-linked-list
3501-delete-nodes-from-linked-list-present-in-array

Simulation

0592-fraction-addition-and-subtraction
1642-water-bottles
1803-average-waiting-time
2006-find-the-student-that-will-replace-the-chalk
2076-sum-of-digits-of-string-after-convert
2155-find-missing-observations
2299-merge-nodes-in-between-zeros
2411-spiral-matrix-iv
2645-pass-the-pillow
2695-find-score-of-an-array-after-marking-all-elements

Math

0002-add-two-numbers
0241-different-ways-to-add-parentheses
0264-ugly-number-ii
0539-minimum-time-difference
0564-find-the-closest-palindrome
0592-fraction-addition-and-subtraction
0650-2-keys-keyboard
1240-stone-game-ii
1642-water-bottles
2155-find-missing-observations
2645-pass-the-pillow
2716-prime-subtraction-operation
2903-insert-greatest-common-divisors-in-linked-list

String

0179-largest-number
0214-shortest-palindrome
0241-different-ways-to-add-parentheses
0539-minimum-time-difference
0564-find-the-closest-palindrome
0592-fraction-addition-and-subtraction
0664-strange-printer
0726-number-of-atoms
0920-uncommon-words-from-two-sentences
1298-reverse-substrings-between-each-pair-of-parentheses
1302-delete-characters-to-make-fancy-string
1473-find-the-longest-substring-containing-vowels-in-even-counts
1720-crawler-log-folder
1786-count-the-number-of-consistent-strings
1818-maximum-score-from-removing-substrings
2076-sum-of-digits-of-string-after-convert
2217-step-by-step-directions-from-a-binary-tree-node-to-another
2494-sum-of-prefix-scores-of-strings
2580-circular-sentence
3329-find-the-length-of-the-longest-common-prefix

Stack

0145-binary-tree-postorder-traversal
0726-number-of-atoms
0776-n-ary-tree-postorder-traversal
1298-reverse-substrings-between-each-pair-of-parentheses
1497-design-a-stack-with-increment-operation
1720-crawler-log-folder
1818-maximum-score-from-removing-substrings

Tree

0145-binary-tree-postorder-traversal
0776-n-ary-tree-postorder-traversal
0789-kth-largest-element-in-a-stream
1207-delete-nodes-and-return-forest
1653-number-of-good-leaf-nodes-pairs
2217-step-by-step-directions-from-a-binary-tree-node-to-another
2306-create-binary-tree-from-descriptions

Binary Tree

0145-binary-tree-postorder-traversal
0789-kth-largest-element-in-a-stream
1207-delete-nodes-and-return-forest
1653-number-of-good-leaf-nodes-pairs
2217-step-by-step-directions-from-a-binary-tree-node-to-another
2306-create-binary-tree-from-descriptions

Matrix

1496-lucky-numbers-in-a-matrix
2035-count-sub-islands
2411-spiral-matrix-iv
2794-maximum-number-of-moves-in-a-grid

Design

0432-all-oone-data-structure
0729-my-calendar-i
0731-my-calendar-ii
0789-kth-largest-element-in-a-stream
0859-design-circular-deque
1497-design-a-stack-with-increment-operation

Binary Search Tree

0789-kth-largest-element-in-a-stream

Data Stream

0789-kth-largest-element-in-a-stream

Backtracking

0039-combination-sum
0040-combination-sum-ii

Dynamic Programming

0053-maximum-subarray
0241-different-ways-to-add-parentheses
0264-ugly-number-ii
0650-2-keys-keyboard
0664-strange-printer
1240-stone-game-ii
1766-minimum-number-of-removals-to-make-mountain-array
2067-maximum-number-of-points-with-cost
2554-minimum-total-distance-traveled
2794-maximum-number-of-moves-in-a-grid

Prefix Sum

0731-my-calendar-ii
1240-stone-game-ii
1435-xor-queries-of-a-subarray
1473-find-the-longest-substring-containing-vowels-in-even-counts
1694-make-sum-divisible-by-p
2006-find-the-student-that-will-replace-the-chalk

Game Theory

1240-stone-game-ii

Bit Manipulation

0476-number-complement
1435-xor-queries-of-a-subarray
1473-find-the-longest-substring-containing-vowels-in-even-counts
1786-count-the-number-of-consistent-strings
2323-minimum-bit-flips-to-convert-number
2503-longest-subarray-with-maximum-bitwise-and
3291-find-if-array-can-be-sorted

Shortest Path

2803-modify-graph-edge-weights

Number Theory

2716-prime-subtraction-operation
2903-insert-greatest-common-divisors-in-linked-list

Divide and Conquer

0053-maximum-subarray

Counting

0920-uncommon-words-from-two-sentences
1786-count-the-number-of-consistent-strings
2494-sum-of-prefix-scores-of-strings

Brainteaser

2503-longest-subarray-with-maximum-bitwise-and

Recursion

0002-add-two-numbers
0241-different-ways-to-add-parentheses

Memoization

0241-different-ways-to-add-parentheses

Rolling Hash

0214-shortest-palindrome

String Matching

0214-shortest-palindrome

Hash Function

0214-shortest-palindrome

Trie

0386-lexicographical-numbers
0440-k-th-smallest-in-lexicographical-order
2494-sum-of-prefix-scores-of-strings
3329-find-the-length-of-the-longest-common-prefix

Segment Tree

0729-my-calendar-i
0731-my-calendar-ii

Ordered Set

0729-my-calendar-i
0731-my-calendar-ii

Queue

0859-design-circular-deque

Doubly-Linked List

0432-all-oone-data-structure

About

Collection of LeetCode questions to ace the coding interview!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages