Skip to content

Abhrajitdas02/Leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coding Practice Repository

Welcome to my coding practice repository! This repository contains my solutions to various coding challenges from LeetCode and GeeksforGeeks. I've organized the solutions by platform and topic, and each solution includes explanations to help you understand the approach.

Feel free to explore the solutions, provide feedback, and use the code for your own learning. If you find these solutions helpful, don't hesitate to give this repository a star ⭐️.

Contents

About

This repository is a collection of my solutions to coding challenges from LeetCode and GeeksforGeeks. Practicing coding problems helps improve problem-solving skills and algorithmic thinking, which are valuable for technical interviews and real-world programming challenges.

Languages

I've provided solutions in the following programming languages:

  • Python
  • Java
  • C++

Feel free to choose the language you're most comfortable with.

Platforms

LeetCode

The LeetCode folder contains solutions to LeetCode problems, organized by topic. Each solution includes the problem statement, code, and explanations if necessary.

GeeksforGeeks (GFG)

The GeeksforGeeks folder contains solutions to GeeksforGeeks problems, categorized by their respective topics. Just like in the LeetCode section, each solution is accompanied by explanations.

How to Use

  1. Browse the LeetCode and GeeksforGeeks folders to find problems categorized by topics.
  2. Each problem solution includes the problem statement, code, and explanations.
  3. You're welcome to use the code for your own learning or even as a reference for your own submissions.
  4. If you're new to coding challenges, start with easier problems and gradually move to more complex ones.

Contributing

Contributions are appreciated! If you'd like to contribute your solutions or improvements, follow these steps:

  1. Fork this repository.
  2. Create a new branch: git checkout -b new-feature
  3. Add your solution in the appropriate folder.
  4. Include clear explanations in your code or in a separate README within the problem folder.
  5. Commit your changes: git commit -m 'Add solution for Problem XYZ'
  6. Push to the branch: git push origin new-feature
  7. Open a pull request, and I'll review it as soon as possible.

Contact

If you have any questions, suggestions, or just want to connect, you can reach me at [email protected].

Happy coding! 🚀

LeetCode Topics

Array

0015-3sum
0026-remove-duplicates-from-sorted-array
0031-next-permutation
0042-trapping-rain-water
0045-jump-game-ii
0053-maximum-subarray
0055-jump-game
0056-merge-intervals
0073-set-matrix-zeroes
0074-search-a-2d-matrix
0075-sort-colors
0080-remove-duplicates-from-sorted-array-ii
0118-pascals-triangle
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0128-longest-consecutive-sequence
0136-single-number
0152-maximum-product-subarray
0162-find-peak-element
0169-majority-element
0189-rotate-array
0198-house-robber
0213-house-robber-ii
0215-kth-largest-element-in-an-array
0219-contains-duplicate-ii
0229-majority-element-ii
0238-product-of-array-except-self
0268-missing-number
0283-move-zeroes
0300-longest-increasing-subsequence
0322-coin-change
0368-largest-divisible-subset
0410-split-array-largest-sum
0416-partition-equal-subset-sum
0435-non-overlapping-intervals
0455-assign-cookies
0485-max-consecutive-ones
0493-reverse-pairs
0496-next-greater-element-i
0503-next-greater-element-ii
0518-coin-change-ii
0542-01-matrix
0560-subarray-sum-equals-k
0605-can-place-flowers
0673-number-of-longest-increasing-subsequence
0735-asteroid-collision
0890-lemonade-change
0907-koko-eating-bananas
0943-sum-of-subarray-minimums
0966-binary-subarrays-with-sum
1036-rotting-oranges
1046-max-consecutive-ones-iii
1056-capacity-to-ship-packages-within-d-days
1112-find-words-that-can-be-formed-by-characters
1129-longest-string-chain
1370-count-number-of-nice-subarrays
1468-check-if-n-and-its-double-exist
1528-kids-with-the-greatest-number-of-candies
1605-minimum-number-of-days-to-make-m-bouquets
1646-kth-missing-positive-number
2094-remove-stones-to-minimize-the-total
2144-maximum-difference-between-increasing-elements
2231-find-first-palindromic-string-in-the-array
2232-adding-spaces-to-a-string
2386-min-max-game
3324-split-the-array
3428-find-the-xor-of-numbers-which-appear-twice

Binary Search

0069-sqrtx
0074-search-a-2d-matrix
0162-find-peak-element
0268-missing-number
0300-longest-increasing-subsequence
0410-split-array-largest-sum
0493-reverse-pairs
0907-koko-eating-bananas
1046-max-consecutive-ones-iii
1056-capacity-to-ship-packages-within-d-days
1468-check-if-n-and-its-double-exist
1605-minimum-number-of-days-to-make-m-bouquets
1646-kth-missing-positive-number

Math

0002-add-two-numbers
0013-roman-to-integer
0069-sqrtx
0070-climbing-stairs
0168-excel-sheet-column-title
0171-excel-sheet-column-number
0189-rotate-array
0268-missing-number
0368-largest-divisible-subset
1146-greatest-common-divisor-of-strings
1370-count-number-of-nice-subarrays
2032-largest-odd-number-in-string

Dynamic Programming

0042-trapping-rain-water
0045-jump-game-ii
0053-maximum-subarray
0055-jump-game
0070-climbing-stairs
0118-pascals-triangle
0121-best-time-to-buy-and-sell-stock
0122-best-time-to-buy-and-sell-stock-ii
0152-maximum-product-subarray
0198-house-robber
0213-house-robber-ii
0300-longest-increasing-subsequence
0322-coin-change
0368-largest-divisible-subset
0392-is-subsequence
0410-split-array-largest-sum
0416-partition-equal-subset-sum
0435-non-overlapping-intervals
0516-longest-palindromic-subsequence
0518-coin-change-ii
0542-01-matrix
0583-delete-operation-for-two-strings
0647-palindromic-substrings
0673-number-of-longest-increasing-subsequence
0943-sum-of-subarray-minimums
1129-longest-string-chain
1170-shortest-common-supersequence
1250-longest-common-subsequence

Greedy

0045-jump-game-ii
0055-jump-game
0122-best-time-to-buy-and-sell-stock-ii
0409-longest-palindrome
0410-split-array-largest-sum
0435-non-overlapping-intervals
0455-assign-cookies
0605-can-place-flowers
0890-lemonade-change
2032-largest-odd-number-in-string
2094-remove-stones-to-minimize-the-total

Prefix Sum

0238-product-of-array-except-self
0410-split-array-largest-sum
0560-subarray-sum-equals-k
0966-binary-subarrays-with-sum
1046-max-consecutive-ones-iii
1370-count-number-of-nice-subarrays

Matrix

0073-set-matrix-zeroes
0074-search-a-2d-matrix
0542-01-matrix
1036-rotting-oranges

Hash Table

0003-longest-substring-without-repeating-characters
0013-roman-to-integer
0073-set-matrix-zeroes
0128-longest-consecutive-sequence
0141-linked-list-cycle
0169-majority-element
0205-isomorphic-strings
0219-contains-duplicate-ii
0229-majority-element-ii
0242-valid-anagram
0268-missing-number
0290-word-pattern
0383-ransom-note
0387-first-unique-character-in-a-string
0389-find-the-difference
0409-longest-palindrome
0424-longest-repeating-character-replacement
0451-sort-characters-by-frequency
0496-next-greater-element-i
0560-subarray-sum-equals-k
0966-binary-subarrays-with-sum
1029-vertical-order-traversal-of-a-binary-tree
1112-find-words-that-can-be-formed-by-characters
1129-longest-string-chain
1370-count-number-of-nice-subarrays
1460-number-of-substrings-containing-all-three-characters
1468-check-if-n-and-its-double-exist
1746-largest-substring-between-two-equal-characters
3324-split-the-array
3428-find-the-xor-of-numbers-which-appear-twice

String

0003-longest-substring-without-repeating-characters
0008-string-to-integer-atoi
0013-roman-to-integer
0014-longest-common-prefix
0020-valid-parentheses
0028-find-the-index-of-the-first-occurrence-in-a-string
0058-length-of-last-word
0151-reverse-words-in-a-string
0168-excel-sheet-column-title
0171-excel-sheet-column-number
0205-isomorphic-strings
0242-valid-anagram
0290-word-pattern
0383-ransom-note
0387-first-unique-character-in-a-string
0389-find-the-difference
0392-is-subsequence
0409-longest-palindrome
0424-longest-repeating-character-replacement
0451-sort-characters-by-frequency
0516-longest-palindromic-subsequence
0583-delete-operation-for-two-strings
0647-palindromic-substrings
0812-rotate-string
1078-remove-outermost-parentheses
1112-find-words-that-can-be-formed-by-characters
1129-longest-string-chain
1146-greatest-common-divisor-of-strings
1170-shortest-common-supersequence
1250-longest-common-subsequence
1460-number-of-substrings-containing-all-three-characters
1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
1737-maximum-nesting-depth-of-the-parentheses
1746-largest-substring-between-two-equal-characters
1894-merge-strings-alternately
2032-largest-odd-number-in-string
2076-sum-of-digits-of-string-after-convert
2231-find-first-palindromic-string-in-the-array
2232-adding-spaces-to-a-string
2235-capitalize-the-title
2304-cells-in-a-range-on-an-excel-sheet
2346-largest-3-same-digit-number-in-string
2414-move-pieces-to-obtain-a-string

Sliding Window

0003-longest-substring-without-repeating-characters
0219-contains-duplicate-ii
0424-longest-repeating-character-replacement
0966-binary-subarrays-with-sum
1046-max-consecutive-ones-iii
1370-count-number-of-nice-subarrays
1460-number-of-substrings-containing-all-three-characters

Database

0175-combine-two-tables
0181-employees-earning-more-than-their-managers
0182-duplicate-emails
0197-rising-temperature
0577-employee-bonus
0584-find-customer-referee
0595-big-countries
0620-not-boring-movies
1153-product-sales-analysis-i
1161-project-employees-i
1245-user-activity-for-the-past-30-days-i
1258-article-views-i
1292-immediate-food-delivery-ii
1338-queries-quality-and-percentage
1415-students-and-examinations
1509-replace-employee-id-with-the-unique-identifier
1724-customer-who-visited-but-did-not-make-any-transactions
1801-average-time-of-process-per-machine
1827-invalid-tweets
1908-recyclable-and-low-fat-products
2495-number-of-unique-subjects-taught-by-each-teacher

Two Pointers

0015-3sum
0026-remove-duplicates-from-sorted-array
0028-find-the-index-of-the-first-occurrence-in-a-string
0031-next-permutation
0042-trapping-rain-water
0075-sort-colors
0080-remove-duplicates-from-sorted-array-ii
0141-linked-list-cycle
0151-reverse-words-in-a-string
0189-rotate-array
0283-move-zeroes
0392-is-subsequence
0455-assign-cookies
0647-palindromic-substrings
1129-longest-string-chain
1468-check-if-n-and-its-double-exist
1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence
1894-merge-strings-alternately
2231-find-first-palindromic-string-in-the-array
2232-adding-spaces-to-a-string
2414-move-pieces-to-obtain-a-string

Bit Manipulation

0136-single-number
0268-missing-number
0389-find-the-difference
3428-find-the-xor-of-numbers-which-appear-twice

Sorting

0015-3sum
0056-merge-intervals
0075-sort-colors
0169-majority-element
0215-kth-largest-element-in-an-array
0229-majority-element-ii
0242-valid-anagram
0268-missing-number
0368-largest-divisible-subset
0389-find-the-difference
0435-non-overlapping-intervals
0451-sort-characters-by-frequency
0455-assign-cookies
1029-vertical-order-traversal-of-a-binary-tree
1129-longest-string-chain
1468-check-if-n-and-its-double-exist

Queue

0225-implement-stack-using-queues
0232-implement-queue-using-stacks
0387-first-unique-character-in-a-string

Counting

0169-majority-element
0229-majority-element-ii
0383-ransom-note
0387-first-unique-character-in-a-string
0451-sort-characters-by-frequency
3324-split-the-array

Divide and Conquer

0053-maximum-subarray
0169-majority-element
0215-kth-largest-element-in-an-array
0493-reverse-pairs

Binary Indexed Tree

0493-reverse-pairs
0673-number-of-longest-increasing-subsequence

Segment Tree

0493-reverse-pairs
0673-number-of-longest-increasing-subsequence

Merge Sort

0493-reverse-pairs

Ordered Set

0493-reverse-pairs

Depth-First Search

0094-binary-tree-inorder-traversal
0100-same-tree
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0144-binary-tree-preorder-traversal
0236-lowest-common-ancestor-of-a-binary-tree
0547-number-of-provinces
0775-n-ary-tree-preorder-traversal
0776-n-ary-tree-postorder-traversal
1029-vertical-order-traversal-of-a-binary-tree

Breadth-First Search

0100-same-tree
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0322-coin-change
0542-01-matrix
0547-number-of-provinces
1029-vertical-order-traversal-of-a-binary-tree
1036-rotting-oranges

Union Find

0128-longest-consecutive-sequence
0547-number-of-provinces

Graph

0547-number-of-provinces

Stack

0020-valid-parentheses
0042-trapping-rain-water
0094-binary-tree-inorder-traversal
0144-binary-tree-preorder-traversal
0155-min-stack
0225-implement-stack-using-queues
0232-implement-queue-using-stacks
0496-next-greater-element-i
0503-next-greater-element-ii
0735-asteroid-collision
0775-n-ary-tree-preorder-traversal
0776-n-ary-tree-postorder-traversal
0943-sum-of-subarray-minimums
1078-remove-outermost-parentheses
1737-maximum-nesting-depth-of-the-parentheses

Trie

0014-longest-common-prefix

String Matching

0028-find-the-index-of-the-first-occurrence-in-a-string
0812-rotate-string
1566-check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence

Heap (Priority Queue)

0215-kth-largest-element-in-an-array
0451-sort-characters-by-frequency
2094-remove-stones-to-minimize-the-total

Bucket Sort

0451-sort-characters-by-frequency

Tree

0094-binary-tree-inorder-traversal
0100-same-tree
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0144-binary-tree-preorder-traversal
0236-lowest-common-ancestor-of-a-binary-tree
0775-n-ary-tree-preorder-traversal
0776-n-ary-tree-postorder-traversal
1029-vertical-order-traversal-of-a-binary-tree

Binary Tree

0094-binary-tree-inorder-traversal
0100-same-tree
0103-binary-tree-zigzag-level-order-traversal
0104-maximum-depth-of-binary-tree
0110-balanced-binary-tree
0144-binary-tree-preorder-traversal
0236-lowest-common-ancestor-of-a-binary-tree
1029-vertical-order-traversal-of-a-binary-tree

Simulation

0735-asteroid-collision
2076-sum-of-digits-of-string-after-convert
2232-adding-spaces-to-a-string
2386-min-max-game

Quickselect

0215-kth-largest-element-in-an-array

Linked List

0002-add-two-numbers
0141-linked-list-cycle
0206-reverse-linked-list

Recursion

0002-add-two-numbers
0206-reverse-linked-list

Memoization

0070-climbing-stairs

Design

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

Monotonic Stack

0042-trapping-rain-water
0496-next-greater-element-i
0503-next-greater-element-ii
0943-sum-of-subarray-minimums

About

repo that contains all my leetcode solutions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published