Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Harshv2608/Leetcode-Solutions

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

604 Commits
604 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Solutions

This repository contains my structured solutions to LeetCode problems. I use this space to strengthen my understanding of Data Structures and Algorithms, improve problem-solving skills, and write optimized, clean implementations.

My focus is on correctness, efficiency, and maintaining clear logic rather than just reaching the final answer.

LeetCode Topics

Array

0001-two-sum
0004-median-of-two-sorted-arrays
0015-3sum
0018-4sum
0026-remove-duplicates-from-sorted-array
0031-next-permutation
0033-search-in-rotated-sorted-array
0034-find-first-and-last-position-of-element-in-sorted-array
0035-search-insert-position
0036-valid-sudoku
0039-combination-sum
0042-trapping-rain-water
0046-permutations
0048-rotate-image
0049-group-anagrams
0053-maximum-subarray
0054-spiral-matrix
0056-merge-intervals
0066-plus-one
0073-set-matrix-zeroes
0075-sort-colors
0080-remove-duplicates-from-sorted-array-ii
0081-search-in-rotated-sorted-array-ii
0088-merge-sorted-array
0118-pascals-triangle
0121-best-time-to-buy-and-sell-stock
0150-evaluate-reverse-polish-notation
0152-maximum-product-subarray
0153-find-minimum-in-rotated-sorted-array
0162-find-peak-element
0167-two-sum-ii-input-array-is-sorted
0169-majority-element
0189-rotate-array
0198-house-robber
0200-number-of-islands
0217-contains-duplicate
0229-majority-element-ii
0283-move-zeroes
0287-find-the-duplicate-number
0347-top-k-frequent-elements
0485-max-consecutive-ones
0493-reverse-pairs
0540-single-element-in-a-sorted-array
0560-subarray-sum-equals-k
0643-maximum-average-subarray-i
0704-binary-search
0875-koko-eating-bananas
0961-n-repeated-element-in-size-2n-array
1095-find-in-mountain-array
1351-count-negative-numbers-in-a-sorted-matrix
1365-how-many-numbers-are-smaller-than-the-current-number
1431-kids-with-the-greatest-number-of-candies
1582-special-positions-in-a-binary-matrix
1637-widest-vertical-area-between-two-points-containing-no-points
1679-max-number-of-k-sum-pairs
1769-minimum-number-of-operations-to-move-all-balls-to-each-box
1980-find-unique-binary-string
2011-final-value-of-variable-after-performing-operations
2149-rearrange-array-elements-by-sign
2344-minimum-deletions-to-make-array-divisible
2401-longest-nice-subarray
2553-separate-the-digits-in-an-array
2574-left-and-right-sum-differences
2789-largest-element-in-an-array-after-merge-operations
2932-maximum-strong-pair-xor-i
2942-find-words-containing-character
3191-minimum-operations-to-make-binary-array-elements-equal-to-one-i
3264-final-array-state-after-k-multiplication-operations-i
3467-transform-array-by-parity
3833-count-dominant-indices
3834-merge-adjacent-equal-elements
3847-find-the-score-difference-in-a-game

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0013-roman-to-integer
0036-valid-sudoku
0049-group-anagrams
0073-set-matrix-zeroes
0169-majority-element
0202-happy-number
0217-contains-duplicate
0229-majority-element-ii
0242-valid-anagram
0347-top-k-frequent-elements
0560-subarray-sum-equals-k
0961-n-repeated-element-in-size-2n-array
1365-how-many-numbers-are-smaller-than-the-current-number
1679-max-number-of-k-sum-pairs
1980-find-unique-binary-string
2932-maximum-strong-pair-xor-i
3760-maximum-substrings-with-distinct-start

Binary Search

0004-median-of-two-sorted-arrays
0033-search-in-rotated-sorted-array
0034-find-first-and-last-position-of-element-in-sorted-array
0035-search-insert-position
0081-search-in-rotated-sorted-array-ii
0153-find-minimum-in-rotated-sorted-array
0162-find-peak-element
0167-two-sum-ii-input-array-is-sorted
0287-find-the-duplicate-number
0493-reverse-pairs
0540-single-element-in-a-sorted-array
0704-binary-search
0875-koko-eating-bananas
1095-find-in-mountain-array
1351-count-negative-numbers-in-a-sorted-matrix
3600-maximize-spanning-tree-stability-with-upgrades

Divide and Conquer

0004-median-of-two-sorted-arrays
0023-merge-k-sorted-lists
0053-maximum-subarray
0169-majority-element
0347-top-k-frequent-elements
0493-reverse-pairs

Math

0002-add-two-numbers
0009-palindrome-number
0013-roman-to-integer
0048-rotate-image
0066-plus-one
0150-evaluate-reverse-polish-notation
0189-rotate-array
0202-happy-number
0224-basic-calculator
0258-add-digits
0326-power-of-three
1281-subtract-the-product-and-sum-of-digits-of-an-integer
1342-number-of-steps-to-reduce-a-number-to-zero
1523-count-odd-numbers-in-an-interval-range
1688-count-of-matches-in-tournament
1925-count-square-sum-triples
2160-minimum-sum-of-four-digit-number-after-splitting-digits
2235-add-two-integers
2344-minimum-deletions-to-make-array-divisible
2396-strictly-palindromic-number
2520-count-the-digits-that-divide-a-number
3264-final-array-state-after-k-multiplication-operations-i

Matrix

0036-valid-sudoku
0048-rotate-image
0054-spiral-matrix
0073-set-matrix-zeroes
0200-number-of-islands
1351-count-negative-numbers-in-a-sorted-matrix
1582-special-positions-in-a-binary-matrix

Sorting

0015-3sum
0018-4sum
0049-group-anagrams
0056-merge-intervals
0075-sort-colors
0088-merge-sorted-array
0169-majority-element
0217-contains-duplicate
0229-majority-element-ii
0242-valid-anagram
0347-top-k-frequent-elements
1365-how-many-numbers-are-smaller-than-the-current-number
1637-widest-vertical-area-between-two-points-containing-no-points
1679-max-number-of-k-sum-pairs
2160-minimum-sum-of-four-digit-number-after-splitting-digits
2344-minimum-deletions-to-make-array-divisible
3467-transform-array-by-parity

Counting Sort

0169-majority-element
0229-majority-element-ii
0347-top-k-frequent-elements
1365-how-many-numbers-are-smaller-than-the-current-number
3467-transform-array-by-parity

String

0003-longest-substring-without-repeating-characters
0013-roman-to-integer
0022-generate-parentheses
0032-longest-valid-parentheses
0049-group-anagrams
0125-valid-palindrome
0151-reverse-words-in-a-string
0224-basic-calculator
0242-valid-anagram
0344-reverse-string
0392-is-subsequence
0557-reverse-words-in-a-string-iii
0680-valid-palindrome-ii
0709-to-lower-case
1047-remove-all-adjacent-duplicates-in-string
1108-defanging-an-ip-address
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
1768-merge-strings-alternately
1769-minimum-number-of-operations-to-move-all-balls-to-each-box
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
2011-final-value-of-variable-after-performing-operations
2942-find-words-containing-character
3110-score-of-a-string
3760-maximum-substrings-with-distinct-start

Stack

0032-longest-valid-parentheses
0042-trapping-rain-water
0114-flatten-binary-tree-to-linked-list
0150-evaluate-reverse-polish-notation
0224-basic-calculator
0225-implement-stack-using-queues
0232-implement-queue-using-stacks
0234-palindrome-linked-list
1047-remove-all-adjacent-duplicates-in-string
3834-merge-adjacent-equal-elements

Two Pointers

0015-3sum
0018-4sum
0026-remove-duplicates-from-sorted-array
0031-next-permutation
0042-trapping-rain-water
0075-sort-colors
0080-remove-duplicates-from-sorted-array-ii
0088-merge-sorted-array
0125-valid-palindrome
0151-reverse-words-in-a-string
0167-two-sum-ii-input-array-is-sorted
0189-rotate-array
0202-happy-number
0234-palindrome-linked-list
0283-move-zeroes
0287-find-the-duplicate-number
0344-reverse-string
0392-is-subsequence
0557-reverse-words-in-a-string-iii
0680-valid-palindrome-ii
1679-max-number-of-k-sum-pairs
1768-merge-strings-alternately
2149-rearrange-array-elements-by-sign
2396-strictly-palindromic-number

Greedy

0680-valid-palindrome-ii
1689-partitioning-into-minimum-number-of-deci-binary-numbers
2160-minimum-sum-of-four-digit-number-after-splitting-digits
2789-largest-element-in-an-array-after-merge-operations
3600-maximize-spanning-tree-stability-with-upgrades

Enumeration

1925-count-square-sum-triples
3827-count-monobit-integers
3833-count-dominant-indices

Bit Manipulation

0287-find-the-duplicate-number
0693-binary-number-with-alternating-bits
1009-complement-of-base-10-integer
1342-number-of-steps-to-reduce-a-number-to-zero
2401-longest-nice-subarray
2932-maximum-strong-pair-xor-i
3191-minimum-operations-to-make-binary-array-elements-equal-to-one-i
3827-count-monobit-integers

Heap (Priority Queue)

0023-merge-k-sorted-lists
0347-top-k-frequent-elements
2344-minimum-deletions-to-make-array-divisible
3264-final-array-state-after-k-multiplication-operations-i

Simulation

0054-spiral-matrix
0258-add-digits
1545-find-kth-bit-in-nth-binary-string
1688-count-of-matches-in-tournament
2011-final-value-of-variable-after-performing-operations
2149-rearrange-array-elements-by-sign
2553-separate-the-digits-in-an-array
3264-final-array-state-after-k-multiplication-operations-i
3834-merge-adjacent-equal-elements
3847-find-the-score-difference-in-a-game

Brainteaser

2396-strictly-palindromic-number

Prefix Sum

0560-subarray-sum-equals-k
1769-minimum-number-of-operations-to-move-all-balls-to-each-box
2574-left-and-right-sum-differences
3129-find-all-possible-stable-binary-arrays-i
3130-find-all-possible-stable-binary-arrays-ii
3191-minimum-operations-to-make-binary-array-elements-equal-to-one-i

Recursion

0002-add-two-numbers
0021-merge-two-sorted-lists
0224-basic-calculator
0234-palindrome-linked-list
0326-power-of-three
1545-find-kth-bit-in-nth-binary-string

Number Theory

0258-add-digits
2344-minimum-deletions-to-make-array-divisible

Trie

2932-maximum-strong-pair-xor-i

Sliding Window

0003-longest-substring-without-repeating-characters
0643-maximum-average-subarray-i
1888-minimum-number-of-flips-to-make-the-binary-string-alternating
2401-longest-nice-subarray
2932-maximum-strong-pair-xor-i
3191-minimum-operations-to-make-binary-array-elements-equal-to-one-i

Dynamic Programming

0022-generate-parentheses
0032-longest-valid-parentheses
0042-trapping-rain-water
0053-maximum-subarray
0118-pascals-triangle
0121-best-time-to-buy-and-sell-stock
0152-maximum-product-subarray
0198-house-robber
0392-is-subsequence
1888-minimum-number-of-flips-to-make-the-binary-string-alternating
3129-find-all-possible-stable-binary-arrays-i
3130-find-all-possible-stable-binary-arrays-ii

Binary Indexed Tree

0493-reverse-pairs

Segment Tree

0493-reverse-pairs

Merge Sort

0023-merge-k-sorted-lists
0493-reverse-pairs

Ordered Set

0493-reverse-pairs

Linked List

0002-add-two-numbers
0021-merge-two-sorted-lists
0023-merge-k-sorted-lists
0114-flatten-binary-tree-to-linked-list
0234-palindrome-linked-list

Tree

0103-binary-tree-zigzag-level-order-traversal
0114-flatten-binary-tree-to-linked-list
0129-sum-root-to-leaf-numbers
0199-binary-tree-right-side-view
0543-diameter-of-binary-tree
0700-search-in-a-binary-search-tree

Depth-First Search

0114-flatten-binary-tree-to-linked-list
0129-sum-root-to-leaf-numbers
0199-binary-tree-right-side-view
0200-number-of-islands
0543-diameter-of-binary-tree

Binary Tree

0103-binary-tree-zigzag-level-order-traversal
0114-flatten-binary-tree-to-linked-list
0129-sum-root-to-leaf-numbers
0199-binary-tree-right-side-view
0543-diameter-of-binary-tree
0700-search-in-a-binary-search-tree

Breadth-First Search

0103-binary-tree-zigzag-level-order-traversal
0199-binary-tree-right-side-view
0200-number-of-islands

Queue

0225-implement-stack-using-queues
0232-implement-queue-using-stacks
3191-minimum-operations-to-make-binary-array-elements-equal-to-one-i

Design

0225-implement-stack-using-queues
0232-implement-queue-using-stacks

Union-Find

0200-number-of-islands
3600-maximize-spanning-tree-stability-with-upgrades

Monotonic Stack

0042-trapping-rain-water

Backtracking

0022-generate-parentheses
0039-combination-sum
0046-permutations
1980-find-unique-binary-string

Interactive

1095-find-in-mountain-array

Database

0197-rising-temperature
0584-find-customer-referee
0595-big-countries
1068-product-sales-analysis-i
1148-article-views-i
1378-replace-employee-id-with-the-unique-identifier
1581-customer-who-visited-but-did-not-make-any-transactions
1683-invalid-tweets

Graph Theory

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

Minimum Spanning Tree

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

Binary Search Tree

0700-search-in-a-binary-search-tree

Bucket Sort

0347-top-k-frequent-elements

Quickselect

0347-top-k-frequent-elements

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.