Skip to content

Ps1231/Leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Solutions in C++


This repository contains my solutions to various LeetCode problems implemented in C++. Each solution is organized in its own folder named after the problem's title or number, and it includes the C++ code, input/output examples, and any additional explanations.

Getting Started


1. Clone this repository to your local machine:
git clone https://github.com/your-username/leetcode-cpp-solutions.git

2. Navigate to the problem folder you're interested in:
cd leetcode-cpp-solutions/ProblemName

3. Open the .cpp file in your preferred C++ IDE or text editor to view the solution.


Problem List

Problem contains questions related to Arrays, 2D Arrays, Matrix, Strings and other Data Structures and Algorithms in a folder along with their name, description and solution with approch explaination.


Contributing


Contributions to this repository are welcome! If you have a better solution, improvement, or a new problem to add, follow these steps:

  1. Fork this repository.

  2. Create a new branch with a descriptive name:

git checkout -b feature/new-problem
  1. Add your solution to the relevant problem folder.

  2. Make sure your code is well-documented and includes explanations if needed.

  3. Test your solution with different test cases to ensure correctness.

  4. Commit your changes:

git commit -am 'Added solution for ProblemName'
  1. Push to your forked repository:
git push origin feature/new-problem
  1. Open a pull request describing the changes you've made.

Acknowledgments

LeetCode for providing a platform to practice coding skills.

@Ps1231 for creating and maintaining this repository.

LeetCode Topics

Array

0001-two-sum
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
0048-rotate-image
0053-maximum-subarray
0054-spiral-matrix
0056-merge-intervals
0073-set-matrix-zeroes
0075-sort-colors
0081-search-in-rotated-sorted-array-ii
0088-merge-sorted-array
0121-best-time-to-buy-and-sell-stock
0128-longest-consecutive-sequence
0136-single-number
0153-find-minimum-in-rotated-sorted-array
0169-majority-element
0189-rotate-array
0198-house-robber
0217-contains-duplicate
0229-majority-element-ii
0283-move-zeroes
0455-assign-cookies
0493-reverse-pairs
0496-next-greater-element-i
0540-single-element-in-a-sorted-array
0560-subarray-sum-equals-k
0724-find-pivot-index
0890-lemonade-change
0907-koko-eating-bananas
1049-minimum-domino-rotations-for-equal-row
1744-number-of-ways-to-form-a-target-string-given-a-dictionary
1878-check-if-array-is-sorted-and-rotated
1966-frequency-of-the-most-frequent-element
2144-maximum-difference-between-increasing-elements
2271-rearrange-array-elements-by-sign
2690-house-robber-iv

String

0003-longest-substring-without-repeating-characters
0008-string-to-integer-atoi
0013-roman-to-integer
0020-valid-parentheses
0151-reverse-words-in-a-string
0205-isomorphic-strings
0242-valid-anagram
0451-sort-characters-by-frequency
0678-valid-parenthesis-string
1078-remove-outermost-parentheses
1744-number-of-ways-to-form-a-target-string-given-a-dictionary
2243-check-if-all-as-appears-before-all-bs

Dynamic Programming

0053-maximum-subarray
0070-climbing-stairs
0121-best-time-to-buy-and-sell-stock
0198-house-robber
0338-counting-bits
0678-valid-parenthesis-string
1013-fibonacci-number
1744-number-of-ways-to-form-a-target-string-given-a-dictionary

Divide and Conquer

0053-maximum-subarray
0169-majority-element
0191-number-of-1-bits
0493-reverse-pairs

Prefix Sum

0560-subarray-sum-equals-k
0724-find-pivot-index
1966-frequency-of-the-most-frequent-element

Hash Table

0001-two-sum
0003-longest-substring-without-repeating-characters
0013-roman-to-integer
0036-valid-sudoku
0073-set-matrix-zeroes
0128-longest-consecutive-sequence
0169-majority-element
0205-isomorphic-strings
0217-contains-duplicate
0229-majority-element-ii
0242-valid-anagram
0451-sort-characters-by-frequency
0496-next-greater-element-i
0560-subarray-sum-equals-k

Sorting

0056-merge-intervals
0075-sort-colors
0088-merge-sorted-array
0169-majority-element
0217-contains-duplicate
0229-majority-element-ii
0242-valid-anagram
0451-sort-characters-by-frequency
0455-assign-cookies
1966-frequency-of-the-most-frequent-element

Counting

0169-majority-element
0229-majority-element-ii
0451-sort-characters-by-frequency

Bit Manipulation

0136-single-number
0191-number-of-1-bits
0231-power-of-two
0338-counting-bits

Two Pointers

0026-remove-duplicates-from-sorted-array
0031-next-permutation
0075-sort-colors
0088-merge-sorted-array
0151-reverse-words-in-a-string
0189-rotate-array
0283-move-zeroes
0455-assign-cookies
0908-middle-of-the-linked-list
2271-rearrange-array-elements-by-sign

Simulation

0054-spiral-matrix
2271-rearrange-array-elements-by-sign

Union Find

0128-longest-consecutive-sequence

Matrix

0036-valid-sudoku
0048-rotate-image
0054-spiral-matrix
0073-set-matrix-zeroes

Math

0007-reverse-integer
0009-palindrome-number
0013-roman-to-integer
0048-rotate-image
0050-powx-n
0070-climbing-stairs
0189-rotate-array
0231-power-of-two
1013-fibonacci-number

Heap (Priority Queue)

0451-sort-characters-by-frequency

Bucket Sort

0451-sort-characters-by-frequency

Binary Search

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
0493-reverse-pairs
0540-single-element-in-a-sorted-array
0907-koko-eating-bananas
1966-frequency-of-the-most-frequent-element
2690-house-robber-iv

Recursion

0050-powx-n
0231-power-of-two
1013-fibonacci-number

Binary Indexed Tree

0493-reverse-pairs

Segment Tree

0493-reverse-pairs

Merge Sort

0493-reverse-pairs

Ordered Set

0493-reverse-pairs

Linked List

0237-delete-node-in-a-linked-list
0908-middle-of-the-linked-list

Stack

0020-valid-parentheses
0155-min-stack
0225-implement-stack-using-queues
0232-implement-queue-using-stacks
0496-next-greater-element-i
0678-valid-parenthesis-string
1078-remove-outermost-parentheses

Design

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

Queue

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

Monotonic Stack

0496-next-greater-element-i

Database

0176-second-highest-salary
0180-consecutive-numbers
0196-delete-duplicate-emails
0197-rising-temperature
0570-managers-with-at-least-5-direct-reports
0577-employee-bonus
0584-find-customer-referee
0595-big-countries
0596-classes-more-than-5-students
0610-triangle-judgement
0619-biggest-single-number
0620-not-boring-movies
0626-exchange-seats
1135-customers-who-bought-all-products
1153-product-sales-analysis-i
1161-project-employees-i
1245-user-activity-for-the-past-30-days-i
1258-article-views-i
1278-product-price-at-a-given-date
1292-immediate-food-delivery-ii
1317-monthly-transactions-i
1338-queries-quality-and-percentage
1390-average-selling-price
1415-students-and-examinations
1462-list-the-products-ordered-in-a-period
1509-replace-employee-id-with-the-unique-identifier
1625-group-sold-products-by-the-date
1664-find-users-with-valid-e-mails
1670-patients-with-a-condition
1724-customer-who-visited-but-did-not-make-any-transactions
1773-percentage-of-users-attended-a-contest
1801-average-time-of-process-per-machine
1811-fix-names-in-a-table
1827-invalid-tweets
1877-find-followers-count
1882-the-number-of-employees-which-report-to-each-employee
1908-recyclable-and-low-fat-products
1942-primary-department-for-each-employee
2087-confirmation-rate
2127-employees-whose-manager-left-the-company
2495-number-of-unique-subjects-taught-by-each-teacher

Memoization

0070-climbing-stairs
1013-fibonacci-number

Greedy

0455-assign-cookies
0678-valid-parenthesis-string
0890-lemonade-change
1049-minimum-domino-rotations-for-equal-row
1966-frequency-of-the-most-frequent-element

Sliding Window

0003-longest-substring-without-repeating-characters
1966-frequency-of-the-most-frequent-element

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published