Skip to content

devxoshakya/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,032 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leetcode

Collection of LeetCode questions and their solutions.

LeetCode Topics

Linked List

0002-add-two-numbers
0021-merge-two-sorted-lists
0061-rotate-list
0083-remove-duplicates-from-sorted-list
0092-reverse-linked-list-ii
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0141-linked-list-cycle
0142-linked-list-cycle-ii
0143-reorder-list
0148-sort-list
0160-intersection-of-two-linked-lists
0203-remove-linked-list-elements
0206-reverse-linked-list
0234-palindrome-linked-list
0237-delete-node-in-a-linked-list
0817-design-hashmap
0860-design-circular-queue
0908-middle-of-the-linked-list
1411-convert-binary-number-in-a-linked-list-to-integer

Recursion

0002-add-two-numbers
0021-merge-two-sorted-lists
0143-reorder-list
0203-remove-linked-list-elements
0206-reverse-linked-list
0234-palindrome-linked-list
0326-power-of-three
0509-fibonacci-number

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0012-integer-to-roman
0013-roman-to-integer
0030-substring-with-concatenation-of-all-words
0041-first-missing-positive
0076-minimum-window-substring
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0141-linked-list-cycle
0142-linked-list-cycle-ii
0160-intersection-of-two-linked-lists
0169-majority-element
0202-happy-number
0205-isomorphic-strings
0219-contains-duplicate-ii
0242-valid-anagram
0268-missing-number
0380-insert-delete-getrandom-o1
0383-ransom-note
0387-first-unique-character-in-a-string
0448-find-all-numbers-disappeared-in-an-array
0560-subarray-sum-equals-k
0817-design-hashmap
1482-how-many-numbers-are-smaller-than-the-current-number
1635-number-of-good-pairs
1960-check-if-the-sentence-is-pangram
3289-the-two-sneaky-numbers-of-digitville

Two Pointers

0011-container-with-most-water
0015-3sum
0026-remove-duplicates-from-sorted-array
0027-remove-element
0042-trapping-rain-water
0061-rotate-list
0080-remove-duplicates-from-sorted-array-ii
0088-merge-sorted-array
0125-valid-palindrome
0141-linked-list-cycle
0142-linked-list-cycle-ii
0143-reorder-list
0148-sort-list
0151-reverse-words-in-a-string
0160-intersection-of-two-linked-lists
0167-two-sum-ii-input-array-is-sorted
0189-rotate-array
0202-happy-number
0234-palindrome-linked-list
0345-reverse-vowels-of-a-string
0392-is-subsequence
0557-reverse-words-in-a-string-iii
0861-flipping-an-image
0908-middle-of-the-linked-list

Math

0002-add-two-numbers
0007-reverse-integer
0009-palindrome-number
0012-integer-to-roman
0013-roman-to-integer
0067-add-binary
0069-sqrtx
0070-climbing-stairs
0171-excel-sheet-column-number
0189-rotate-array
0202-happy-number
0268-missing-number
0292-nim-game
0326-power-of-three
0367-valid-perfect-square
0371-sum-of-two-integers
0380-insert-delete-getrandom-o1
0412-fizz-buzz
0441-arranging-coins
0509-fibonacci-number
0989-add-to-array-form-of-integer
1031-add-to-array-form-of-integer
1378-cells-with-odd-values-in-a-matrix
1411-convert-binary-number-in-a-linked-list-to-integer
1421-find-numbers-with-even-number-of-digits
1426-find-n-unique-integers-sum-up-to-zero
1635-number-of-good-pairs
3099-harshad-number
3280-convert-date-to-binary
3289-the-two-sneaky-numbers-of-digitville

Divide and Conquer

0053-maximum-subarray
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0108-convert-sorted-array-to-binary-search-tree
0148-sort-list
0169-majority-element
0191-number-of-1-bits
0918-maximum-sum-circular-subarray
0948-sort-an-array

Sorting

0015-3sum
0088-merge-sorted-array
0148-sort-list
0169-majority-element
0242-valid-anagram
0268-missing-number
0274-h-index
0948-sort-an-array
1482-how-many-numbers-are-smaller-than-the-current-number
1970-sorting-the-sentence

Merge Sort

0148-sort-list
0948-sort-an-array

Stack

0020-valid-parentheses
0042-trapping-rain-water
0084-largest-rectangle-in-histogram
0094-binary-tree-inorder-traversal
0114-flatten-binary-tree-to-linked-list
0143-reorder-list
0145-binary-tree-postorder-traversal
0232-implement-queue-using-stacks
0234-palindrome-linked-list
0957-minimum-add-to-make-parentheses-valid
1475-final-prices-with-a-special-discount-in-a-shop
1648-minimum-insertions-to-balance-a-parentheses-string

Design

0232-implement-queue-using-stacks
0380-insert-delete-getrandom-o1
0817-design-hashmap
0860-design-circular-queue

Queue

0232-implement-queue-using-stacks
0387-first-unique-character-in-a-string
0860-design-circular-queue
0918-maximum-sum-circular-subarray

Array

0001-two-sum
0011-container-with-most-water
0014-longest-common-prefix
0015-3sum
0026-remove-duplicates-from-sorted-array
0027-remove-element
0034-find-first-and-last-position-of-element-in-sorted-array
0041-first-missing-positive
0042-trapping-rain-water
0045-jump-game-ii
0053-maximum-subarray
0055-jump-game
0079-word-search
0080-remove-duplicates-from-sorted-array-ii
0084-largest-rectangle-in-histogram
0088-merge-sorted-array
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0108-convert-sorted-array-to-binary-search-tree
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0134-gas-station
0135-candy
0167-two-sum-ii-input-array-is-sorted
0169-majority-element
0189-rotate-array
0209-minimum-size-subarray-sum
0219-contains-duplicate-ii
0238-product-of-array-except-self
0268-missing-number
0274-h-index
0380-insert-delete-getrandom-o1
0448-find-all-numbers-disappeared-in-an-array
0485-max-consecutive-ones
0560-subarray-sum-equals-k
0745-find-smallest-letter-greater-than-target
0817-design-hashmap
0860-design-circular-queue
0861-flipping-an-image
0898-transpose-matrix
0918-maximum-sum-circular-subarray
0948-sort-an-array
0989-add-to-array-form-of-integer
1031-add-to-array-form-of-integer
1186-maximum-subarray-sum-with-one-deletion
1378-cells-with-odd-values-in-a-matrix
1421-find-numbers-with-even-number-of-digits
1426-find-n-unique-integers-sum-up-to-zero
1470-shuffle-the-array
1475-final-prices-with-a-special-discount-in-a-shop
1482-how-many-numbers-are-smaller-than-the-current-number
1496-lucky-numbers-in-a-matrix
1505-create-target-array-in-the-given-order
1528-kids-with-the-greatest-number-of-candies
1580-shuffle-the-array
1603-running-sum-of-1d-array
1635-number-of-good-pairs
1646-kth-missing-positive-number
1651-shuffle-string
1677-matrix-diagonal-sum
1781-check-if-two-string-arrays-are-equivalent
1791-richest-customer-wealth
1899-count-items-matching-a-rule
1929-concatenation-of-array
2048-build-array-from-permutation
2058-concatenation-of-array
2099-number-of-strings-that-appear-as-substrings-in-word
2350-find-closest-number-to-zero
3028-ant-on-the-boundary
3033-modify-the-matrix
3038-maximum-number-of-operations-with-the-same-score-i
3042-count-prefix-and-suffix-pairs-i
3151-special-array-i
3285-find-indices-of-stable-mountains
3289-the-two-sneaky-numbers-of-digitville

Monotonic Stack

0042-trapping-rain-water
0084-largest-rectangle-in-histogram
1475-final-prices-with-a-special-discount-in-a-shop

String

0003-longest-substring-without-repeating-characters
0006-zigzag-conversion
0012-integer-to-roman
0013-roman-to-integer
0014-longest-common-prefix
0020-valid-parentheses
0030-substring-with-concatenation-of-all-words
0058-length-of-last-word
0067-add-binary
0076-minimum-window-substring
0079-word-search
0125-valid-palindrome
0151-reverse-words-in-a-string
0171-excel-sheet-column-number
0205-isomorphic-strings
0242-valid-anagram
0345-reverse-vowels-of-a-string
0383-ransom-note
0387-first-unique-character-in-a-string
0392-is-subsequence
0412-fizz-buzz
0557-reverse-words-in-a-string-iii
0657-robot-return-to-origin
0742-to-lower-case
0957-minimum-add-to-make-parentheses-valid
1205-defanging-an-ip-address
1648-minimum-insertions-to-balance-a-parentheses-string
1651-shuffle-string
1781-check-if-two-string-arrays-are-equivalent
1797-goal-parser-interpretation
1823-determine-if-string-halves-are-alike
1899-count-items-matching-a-rule
1960-check-if-the-sentence-is-pangram
1970-sorting-the-sentence
2099-number-of-strings-that-appear-as-substrings-in-word
3042-count-prefix-and-suffix-pairs-i
3110-score-of-a-string
3280-convert-date-to-binary

Greedy

0011-container-with-most-water
0045-jump-game-ii
0055-jump-game
0122-best-time-to-buy-and-sell-stock-ii
0134-gas-station
0135-candy
0957-minimum-add-to-make-parentheses-valid
1648-minimum-insertions-to-balance-a-parentheses-string

Tree

0094-binary-tree-inorder-traversal
0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0107-binary-tree-level-order-traversal-ii
0108-convert-sorted-array-to-binary-search-tree
0110-balanced-binary-tree
0112-path-sum
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0145-binary-tree-postorder-traversal
0199-binary-tree-right-side-view
0222-count-complete-tree-nodes
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0404-sum-of-left-leaves
0543-diameter-of-binary-tree
0637-average-of-levels-in-binary-tree
1035-cousins-in-binary-tree

Breadth-First Search

0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0107-binary-tree-level-order-traversal-ii
0112-path-sum
0116-populating-next-right-pointers-in-each-node
0199-binary-tree-right-side-view
0226-invert-binary-tree
0404-sum-of-left-leaves
0637-average-of-levels-in-binary-tree
1035-cousins-in-binary-tree

Binary Tree

0094-binary-tree-inorder-traversal
0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0102-binary-tree-level-order-traversal
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0105-construct-binary-tree-from-preorder-and-inorder-traversal
0107-binary-tree-level-order-traversal-ii
0108-convert-sorted-array-to-binary-search-tree
0110-balanced-binary-tree
0112-path-sum
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0145-binary-tree-postorder-traversal
0199-binary-tree-right-side-view
0222-count-complete-tree-nodes
0226-invert-binary-tree
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0236-lowest-common-ancestor-of-a-binary-tree
0404-sum-of-left-leaves
0543-diameter-of-binary-tree
0637-average-of-levels-in-binary-tree
1035-cousins-in-binary-tree

Depth-First Search

0079-word-search
0094-binary-tree-inorder-traversal
0098-validate-binary-search-tree
0100-same-tree
0101-symmetric-tree
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0112-path-sum
0114-flatten-binary-tree-to-linked-list
0116-populating-next-right-pointers-in-each-node
0145-binary-tree-postorder-traversal
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
0236-lowest-common-ancestor-of-a-binary-tree
0404-sum-of-left-leaves
0543-diameter-of-binary-tree
0637-average-of-levels-in-binary-tree
1035-cousins-in-binary-tree

Binary Search Tree

0034-find-first-and-last-position-of-element-in-sorted-array
0069-sqrtx
0098-validate-binary-search-tree
0108-convert-sorted-array-to-binary-search-tree
0167-two-sum-ii-input-array-is-sorted
0209-minimum-size-subarray-sum
0222-count-complete-tree-nodes
0230-kth-smallest-element-in-a-bst
0235-lowest-common-ancestor-of-a-binary-search-tree
0268-missing-number
0278-first-bad-version
0367-valid-perfect-square
0374-guess-number-higher-or-lower
0441-arranging-coins
0745-find-smallest-letter-greater-than-target
1646-kth-missing-positive-number

Simulation

0067-add-binary
0412-fizz-buzz
0657-robot-return-to-origin
0861-flipping-an-image
0898-transpose-matrix
1378-cells-with-odd-values-in-a-matrix
1505-create-target-array-in-the-given-order
1929-concatenation-of-array
2048-build-array-from-permutation
2058-concatenation-of-array
3028-ant-on-the-boundary
3038-maximum-number-of-operations-with-the-same-score-i

Prefix Sum

0209-minimum-size-subarray-sum
0238-product-of-array-except-self
0560-subarray-sum-equals-k
1603-running-sum-of-1d-array
3028-ant-on-the-boundary

Matrix

0079-word-search
0861-flipping-an-image
0898-transpose-matrix
1496-lucky-numbers-in-a-matrix
1677-matrix-diagonal-sum
1791-richest-customer-wealth
3033-modify-the-matrix

Counting

0169-majority-element
0383-ransom-note
0387-first-unique-character-in-a-string
1482-how-many-numbers-are-smaller-than-the-current-number
1635-number-of-good-pairs
1823-determine-if-string-halves-are-alike

Bit Manipulation

0067-add-binary
0191-number-of-1-bits
0222-count-complete-tree-nodes
0268-missing-number
0371-sum-of-two-integers
0861-flipping-an-image

Trie

0014-longest-common-prefix
3042-count-prefix-and-suffix-pairs-i

Hash Function

0817-design-hashmap
3042-count-prefix-and-suffix-pairs-i

Interactive

0278-first-bad-version
0374-guess-number-higher-or-lower

Concurrency

1203-print-in-order

Sliding Window

0003-longest-substring-without-repeating-characters
0030-substring-with-concatenation-of-all-words
0076-minimum-window-substring
0209-minimum-size-subarray-sum
0219-contains-duplicate-ii

Heap (Priority Queue)

0948-sort-an-array

Bucket Sort

0948-sort-an-array

Radix Sort

0948-sort-an-array

Counting Sort

0274-h-index
0948-sort-an-array

Backtracking

0079-word-search

Dynamic Programming

0042-trapping-rain-water
0045-jump-game-ii
0053-maximum-subarray
0055-jump-game
0070-climbing-stairs
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0392-is-subsequence
0509-fibonacci-number
0918-maximum-sum-circular-subarray
1186-maximum-subarray-sum-with-one-deletion

Memoization

0070-climbing-stairs
0509-fibonacci-number

Database

0175-combine-two-tables
0181-employees-earning-more-than-their-managers
0584-find-customer-referee
0620-not-boring-movies

Randomized

0380-insert-delete-getrandom-o1

Brainteaser

0292-nim-game

Game Theory

0292-nim-game

Monotonic Queue

0918-maximum-sum-circular-subarray

Rolling Hash

3042-count-prefix-and-suffix-pairs-i

String Matching

3042-count-prefix-and-suffix-pairs-i

About

Collection of LeetCode questions that i have solved

Resources

Stars

Watchers

Forks

Contributors 2

  •  
  •