Skip to content

gkamboj/LeetCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2,690 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode

Collection of LeetCode questions

LeetCode Topics

Array

0001-two-sum
0004-median-of-two-sorted-arrays
0011-container-with-most-water
0015-3sum
0033-search-in-rotated-sorted-array
0036-valid-sudoku
0041-first-missing-positive
0042-trapping-rain-water
0048-rotate-image
0049-group-anagrams
0053-maximum-subarray
0054-spiral-matrix
0056-merge-intervals
0057-insert-interval
0066-plus-one
0073-set-matrix-zeroes
0074-search-a-2d-matrix
0078-subsets
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0121-best-time-to-buy-and-sell-stock
0128-longest-consecutive-sequence
0136-single-number
0150-evaluate-reverse-polish-notation
0153-find-minimum-in-rotated-sorted-array
0167-two-sum-ii-input-array-is-sorted
0215-kth-largest-element-in-an-array
0217-contains-duplicate
0238-product-of-array-except-self
0268-missing-number
0287-find-the-duplicate-number
0347-top-k-frequent-elements
0435-non-overlapping-intervals
0621-task-scheduler
0704-binary-search
0735-asteroid-collision
0739-daily-temperatures
0792-binary-search
0853-car-fleet
0875-koko-eating-bananas
0883-car-fleet
0907-koko-eating-bananas
0973-k-closest-points-to-origin
1046-last-stone-weight
1094-car-pooling
1423-maximum-points-you-can-obtain-from-cards
2013-detect-squares
2946-matrix-similarity-after-cyclic-shifts

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0036-valid-sudoku
0041-first-missing-positive
0049-group-anagrams
0073-set-matrix-zeroes
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0128-longest-consecutive-sequence
0138-copy-list-with-random-pointer
0141-linked-list-cycle
0146-lru-cache
0202-happy-number
0217-contains-duplicate
0242-valid-anagram
0268-missing-number
0347-top-k-frequent-elements
0355-design-twitter
0424-longest-repeating-character-replacement
0567-permutation-in-string
0621-task-scheduler
0791-custom-sort-string
0981-time-based-key-value-store
1023-time-based-key-value-store
2013-detect-squares

Sorting

0015-3sum
0049-group-anagrams
0056-merge-intervals
0215-kth-largest-element-in-an-array
0217-contains-duplicate
0242-valid-anagram
0268-missing-number
0347-top-k-frequent-elements
0435-non-overlapping-intervals
0621-task-scheduler
0791-custom-sort-string
0853-car-fleet
0883-car-fleet
0973-k-closest-points-to-origin
1094-car-pooling

String

0003-longest-substring-without-repeating-characters
0006-zigzag-conversion
0020-valid-parentheses
0022-generate-parentheses
0043-multiply-strings
0049-group-anagrams
0125-valid-palindrome
0242-valid-anagram
0424-longest-repeating-character-replacement
0567-permutation-in-string
0791-custom-sort-string
0981-time-based-key-value-store
1023-time-based-key-value-store
1208-get-equal-substrings-within-budget

Prefix Sum

0238-product-of-array-except-self
1094-car-pooling
1208-get-equal-substrings-within-budget
1423-maximum-points-you-can-obtain-from-cards

Union Find

0128-longest-consecutive-sequence

Linked List

0002-add-two-numbers
0019-remove-nth-node-from-end-of-list
0021-merge-two-sorted-lists
0138-copy-list-with-random-pointer
0141-linked-list-cycle
0143-reorder-list
0146-lru-cache
0206-reverse-linked-list
0355-design-twitter
1367-linked-list-in-binary-tree

Two Pointers

0011-container-with-most-water
0015-3sum
0019-remove-nth-node-from-end-of-list
0042-trapping-rain-water
0125-valid-palindrome
0141-linked-list-cycle
0143-reorder-list
0167-two-sum-ii-input-array-is-sorted
0202-happy-number
0287-find-the-duplicate-number
0567-permutation-in-string

Stack

0020-valid-parentheses
0042-trapping-rain-water
0143-reorder-list
0150-evaluate-reverse-polish-notation
0155-min-stack
0735-asteroid-collision
0739-daily-temperatures
0853-car-fleet
0883-car-fleet

Recursion

0002-add-two-numbers
0021-merge-two-sorted-lists
0050-powx-n
0143-reorder-list
0206-reverse-linked-list
1922-count-good-numbers

Divide and Conquer

0004-median-of-two-sorted-arrays
0053-maximum-subarray
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0190-reverse-bits
0191-number-of-1-bits
0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
0973-k-closest-points-to-origin

Heap (Priority Queue)

0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
0355-design-twitter
0621-task-scheduler
0703-kth-largest-element-in-a-stream
0973-k-closest-points-to-origin
1046-last-stone-weight
1094-car-pooling

Bucket Sort

0347-top-k-frequent-elements

Counting

0347-top-k-frequent-elements
0621-task-scheduler
2013-detect-squares

Quickselect

0215-kth-largest-element-in-an-array
0347-top-k-frequent-elements
0973-k-closest-points-to-origin

Matrix

0036-valid-sudoku
0048-rotate-image
0054-spiral-matrix
0073-set-matrix-zeroes
0074-search-a-2d-matrix
2946-matrix-similarity-after-cyclic-shifts

Binary Search

0004-median-of-two-sorted-arrays
0033-search-in-rotated-sorted-array
0074-search-a-2d-matrix
0153-find-minimum-in-rotated-sorted-array
0167-two-sum-ii-input-array-is-sorted
0268-missing-number
0287-find-the-duplicate-number
0704-binary-search
0792-binary-search
0875-koko-eating-bananas
0907-koko-eating-bananas
0981-time-based-key-value-store
1023-time-based-key-value-store
1208-get-equal-substrings-within-budget

Greedy

0011-container-with-most-water
0435-non-overlapping-intervals
0621-task-scheduler

Dynamic Programming

0022-generate-parentheses
0042-trapping-rain-water
0053-maximum-subarray
0121-best-time-to-buy-and-sell-stock
0338-counting-bits
0435-non-overlapping-intervals

Monotonic Stack

0042-trapping-rain-water
0739-daily-temperatures
0853-car-fleet
0883-car-fleet

Sliding Window

0003-longest-substring-without-repeating-characters
0424-longest-repeating-character-replacement
0567-permutation-in-string
1208-get-equal-substrings-within-budget
1423-maximum-points-you-can-obtain-from-cards

Design

0146-lru-cache
0155-min-stack
0355-design-twitter
0703-kth-largest-element-in-a-stream
0981-time-based-key-value-store
1023-time-based-key-value-store
2013-detect-squares

Backtracking

0022-generate-parentheses
0078-subsets

Math

0002-add-two-numbers
0007-reverse-integer
0043-multiply-strings
0048-rotate-image
0050-powx-n
0066-plus-one
0150-evaluate-reverse-polish-notation
0202-happy-number
0268-missing-number
0371-sum-of-two-integers
0973-k-closest-points-to-origin
1922-count-good-numbers
2946-matrix-similarity-after-cyclic-shifts

Bit Manipulation

0078-subsets
0136-single-number
0190-reverse-bits
0191-number-of-1-bits
0268-missing-number
0287-find-the-duplicate-number
0338-counting-bits
0371-sum-of-two-integers

Union-Find

0128-longest-consecutive-sequence

Doubly-Linked List

0146-lru-cache

Simulation

0043-multiply-strings
0054-spiral-matrix
0735-asteroid-collision
1094-car-pooling
2946-matrix-similarity-after-cyclic-shifts

Data Stream

0703-kth-largest-element-in-a-stream
2013-detect-squares

Tree

0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0110-balanced-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0662-maximum-width-of-binary-tree
0669-trim-a-binary-search-tree
0703-kth-largest-element-in-a-stream
1367-linked-list-in-binary-tree
1448-count-good-nodes-in-binary-tree

Binary Search Tree

0098-validate-binary-search-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0669-trim-a-binary-search-tree
0703-kth-largest-element-in-a-stream

Binary Tree

0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0110-balanced-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0662-maximum-width-of-binary-tree
0669-trim-a-binary-search-tree
0703-kth-largest-element-in-a-stream
1367-linked-list-in-binary-tree
1448-count-good-nodes-in-binary-tree

Geometry

0973-k-closest-points-to-origin

Depth-First Search

0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0543-diameter-of-binary-tree
0572-subtree-of-another-tree
0662-maximum-width-of-binary-tree
0669-trim-a-binary-search-tree
1367-linked-list-in-binary-tree
1448-count-good-nodes-in-binary-tree

Breadth-First Search

0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0104-maximum-depth-of-binary-tree
0199-binary-tree-right-side-view
0226-invert-binary-tree
0662-maximum-width-of-binary-tree
1448-count-good-nodes-in-binary-tree

String Matching

0572-subtree-of-another-tree

Hash Function

0572-subtree-of-another-tree

About

Collection of LeetCode questions to ace the coding interview!

Topics

Resources

Stars

Watchers

Forks

Contributors