Skip to content

This repository is a curated collection of LeetCode problem solutions implemented in Java. It serves both as a personal practice journal and a resource for anyone looking to understand problem-solving approaches across various algorithm and data structure topics.

Notifications You must be signed in to change notification settings

janvi100104/Leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leetcode

LeetCode Topics

Math

0066-plus-one
0268-missing-number
0368-largest-divisible-subset
1421-find-numbers-with-even-number-of-digits
1477-product-of-the-last-k-numbers
1631-number-of-sub-arrays-with-odd-sum
1889-check-if-number-is-a-sum-of-powers-of-three
1993-sum-of-all-subset-xor-totals
2383-add-two-integers
2448-count-number-of-bad-pairs
2610-closest-prime-numbers-in-range
2649-count-total-number-of-colored-cells
2802-find-the-punishment-number-of-an-integer
3227-find-missing-and-repeated-values
3243-count-the-number-of-powerful-integers

Array

0001-two-sum
0026-remove-duplicates-from-sorted-array
0027-remove-element
0034-find-first-and-last-position-of-element-in-sorted-array
0035-search-insert-position
0041-first-missing-positive
0066-plus-one
0088-merge-sorted-array
0169-majority-element
0268-missing-number
0283-move-zeroes
0287-find-the-duplicate-number
0368-largest-divisible-subset
0442-find-all-duplicates-in-an-array
0448-find-all-numbers-disappeared-in-an-array
0645-set-mismatch
0792-binary-search
0905-length-of-longest-fibonacci-subsequence
0925-construct-binary-tree-from-preorder-and-postorder-traversal
1049-minimum-domino-rotations-for-equal-row
1227-number-of-equivalent-domino-pairs
1335-maximum-candies-allocated-to-k-children
1364-tuple-with-same-product
1421-find-numbers-with-even-number-of-digits
1477-product-of-the-last-k-numbers
1631-number-of-sub-arrays-with-odd-sum
1791-richest-customer-wealth
1849-maximum-absolute-sum-of-any-subarray
1927-maximum-ascending-subarray-sum
1993-sum-of-all-subset-xor-totals
2048-build-array-from-permutation
2107-find-unique-binary-string
2180-maximum-number-of-tasks-you-can-assign
2220-find-all-possible-recipes-from-given-supplies
2262-solving-questions-with-brainpower
2308-divide-array-into-equal-pairs
2448-count-number-of-bad-pairs
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2551-apply-operations-to-an-array
2564-most-profitable-path-in-a-tree
2614-maximum-count-of-positive-integer-and-negative-integer
2665-minimum-time-to-repair-cars
2690-house-robber-iv
2707-merge-two-2d-arrays-by-summing-values
3152-maximum-value-of-an-ordered-triplet-ii
3154-maximum-value-of-an-ordered-triplet-i
3227-find-missing-and-repeated-values
3332-minimum-operations-to-exceed-threshold-value-ii
3348-minimum-cost-walk-in-weighted-graph
3427-special-array-ii
3430-count-days-without-meetings
3434-find-the-number-of-distinct-colors-among-the-balls
3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i
3483-alternating-groups-ii
3621-minimum-operations-to-make-array-values-equal-to-k
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii
3643-zero-array-transformation-ii
3657-check-if-grid-can-be-cut-into-sections

Binary Search

0034-find-first-and-last-position-of-element-in-sorted-array
0035-search-insert-position
0268-missing-number
0287-find-the-duplicate-number
0792-binary-search
1335-maximum-candies-allocated-to-k-children
2180-maximum-number-of-tasks-you-can-assign
2614-maximum-count-of-positive-integer-and-negative-integer
2665-minimum-time-to-repair-cars
2690-house-robber-iv
3427-special-array-ii
3643-zero-array-transformation-ii

Prefix Sum

1477-product-of-the-last-k-numbers
1631-number-of-sub-arrays-with-odd-sum
3427-special-array-ii
3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i
3643-zero-array-transformation-ii

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0041-first-missing-positive
0169-majority-element
0268-missing-number
0442-find-all-duplicates-in-an-array
0448-find-all-numbers-disappeared-in-an-array
0645-set-mismatch
0905-length-of-longest-fibonacci-subsequence
0925-construct-binary-tree-from-preorder-and-postorder-traversal
1160-letter-tile-possibilities
1218-lowest-common-ancestor-of-deepest-leaves
1227-number-of-equivalent-domino-pairs
1364-tuple-with-same-product
1387-find-elements-in-a-contaminated-binary-tree
1460-number-of-substrings-containing-all-three-characters
1915-check-if-one-string-swap-can-make-strings-equal
2107-find-unique-binary-string
2220-find-all-possible-recipes-from-given-supplies
2308-divide-array-into-equal-pairs
2434-design-a-number-container-system
2448-count-number-of-bad-pairs
2473-max-sum-of-a-pair-with-equal-sum-of-digits
2707-merge-two-2d-arrays-by-summing-values
3227-find-missing-and-repeated-values
3434-find-the-number-of-distinct-colors-among-the-balls
3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii
3621-minimum-operations-to-make-array-values-equal-to-k

String

0003-longest-substring-without-repeating-characters
0868-push-dominoes
1093-recover-a-tree-from-preorder-traversal
1160-letter-tile-possibilities
1170-shortest-common-supersequence
1460-number-of-substrings-containing-all-three-characters
1516-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
1915-check-if-one-string-swap-can-make-strings-equal
2021-remove-all-occurrences-of-a-substring
2107-find-unique-binary-string
2220-find-all-possible-recipes-from-given-supplies
2456-construct-smallest-number-from-di-string
2463-minimum-recolors-to-get-k-consecutive-black-blocks
3243-count-the-number-of-powerful-integers
3447-clear-digits
3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii

Counting

0169-majority-element
1160-letter-tile-possibilities
1227-number-of-equivalent-domino-pairs
1364-tuple-with-same-product
1915-check-if-one-string-swap-can-make-strings-equal
2308-divide-array-into-equal-pairs
2448-count-number-of-bad-pairs
2614-maximum-count-of-positive-integer-and-negative-integer

Simulation

2021-remove-all-occurrences-of-a-substring
2048-build-array-from-permutation
2551-apply-operations-to-an-array
3332-minimum-operations-to-exceed-threshold-value-ii
3434-find-the-number-of-distinct-colors-among-the-balls
3447-clear-digits

Design

1387-find-elements-in-a-contaminated-binary-tree
1477-product-of-the-last-k-numbers
2434-design-a-number-container-system

Heap (Priority Queue)

2434-design-a-number-container-system
2473-max-sum-of-a-pair-with-equal-sum-of-digits
3332-minimum-operations-to-exceed-threshold-value-ii
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii

Ordered Set

2434-design-a-number-container-system

Stack

2021-remove-all-occurrences-of-a-substring
2456-construct-smallest-number-from-di-string
3447-clear-digits

Sorting

0088-merge-sorted-array
0169-majority-element
0268-missing-number
0368-largest-divisible-subset
0645-set-mismatch
2180-maximum-number-of-tasks-you-can-assign
2473-max-sum-of-a-pair-with-equal-sum-of-digits
3430-count-days-without-meetings
3657-check-if-grid-can-be-cut-into-sections

Data Stream

1477-product-of-the-last-k-numbers

Backtracking

1160-letter-tile-possibilities
1516-the-k-th-lexicographical-string-of-all-happy-strings-of-length-n
1993-sum-of-all-subset-xor-totals
2107-find-unique-binary-string
2456-construct-smallest-number-from-di-string
2802-find-the-punishment-number-of-an-integer

Greedy

1049-minimum-domino-rotations-for-equal-row
2180-maximum-number-of-tasks-you-can-assign
2456-construct-smallest-number-from-di-string

Tree

0925-construct-binary-tree-from-preorder-and-postorder-traversal
1093-recover-a-tree-from-preorder-traversal
1218-lowest-common-ancestor-of-deepest-leaves
1387-find-elements-in-a-contaminated-binary-tree
2564-most-profitable-path-in-a-tree

Depth-First Search

0210-course-schedule-ii
1093-recover-a-tree-from-preorder-traversal
1218-lowest-common-ancestor-of-deepest-leaves
1387-find-elements-in-a-contaminated-binary-tree
2564-most-profitable-path-in-a-tree
2793-count-the-number-of-complete-components

Breadth-First Search

0210-course-schedule-ii
1218-lowest-common-ancestor-of-deepest-leaves
1387-find-elements-in-a-contaminated-binary-tree
2564-most-profitable-path-in-a-tree
2793-count-the-number-of-complete-components

Binary Tree

0925-construct-binary-tree-from-preorder-and-postorder-traversal
1093-recover-a-tree-from-preorder-traversal
1218-lowest-common-ancestor-of-deepest-leaves
1387-find-elements-in-a-contaminated-binary-tree

Divide and Conquer

0169-majority-element
0925-construct-binary-tree-from-preorder-and-postorder-traversal

Graph

0210-course-schedule-ii
2090-number-of-ways-to-arrive-at-destination
2220-find-all-possible-recipes-from-given-supplies
2564-most-profitable-path-in-a-tree
2793-count-the-number-of-complete-components
3348-minimum-cost-walk-in-weighted-graph
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii

Dynamic Programming

0368-largest-divisible-subset
0806-domino-and-tromino-tiling
0868-push-dominoes
0905-length-of-longest-fibonacci-subsequence
1170-shortest-common-supersequence
1631-number-of-sub-arrays-with-odd-sum
1849-maximum-absolute-sum-of-any-subarray
2090-number-of-ways-to-arrive-at-destination
2262-solving-questions-with-brainpower
3243-count-the-number-of-powerful-integers

Two Pointers

0026-remove-duplicates-from-sorted-array
0027-remove-element
0088-merge-sorted-array
0283-move-zeroes
0287-find-the-duplicate-number
0868-push-dominoes
2551-apply-operations-to-an-array
2707-merge-two-2d-arrays-by-summing-values

Matrix

1791-richest-customer-wealth
3227-find-missing-and-repeated-values
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii

Number Theory

2610-closest-prime-numbers-in-range

Sliding Window

0003-longest-substring-without-repeating-characters
1460-number-of-substrings-containing-all-three-characters
2463-minimum-recolors-to-get-k-consecutive-black-blocks
3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i
3483-alternating-groups-ii
3569-count-of-substrings-containing-every-vowel-and-k-consonants-ii

Bit Manipulation

0268-missing-number
0287-find-the-duplicate-number
0645-set-mismatch
1993-sum-of-all-subset-xor-totals
2308-divide-array-into-equal-pairs
3348-minimum-cost-walk-in-weighted-graph
3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i

Queue

2180-maximum-number-of-tasks-you-can-assign
3475-minimum-operations-to-make-binary-array-elements-equal-to-one-i

Union Find

2793-count-the-number-of-complete-components
3348-minimum-cost-walk-in-weighted-graph

Topological Sort

0210-course-schedule-ii
2090-number-of-ways-to-arrive-at-destination
2220-find-all-possible-recipes-from-given-supplies

Shortest Path

2090-number-of-ways-to-arrive-at-destination
3627-find-minimum-time-to-reach-last-room-i
3628-find-minimum-time-to-reach-last-room-ii

Combinatorics

1993-sum-of-all-subset-xor-totals

Enumeration

1993-sum-of-all-subset-xor-totals

Monotonic Queue

2180-maximum-number-of-tasks-you-can-assign

About

This repository is a curated collection of LeetCode problem solutions implemented in Java. It serves both as a personal practice journal and a resource for anyone looking to understand problem-solving approaches across various algorithm and data structure topics.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages