Skip to content

The GitHub repository dinesh776/leetcode is a collection of solutions to various LeetCode problems, implemented in Java. Each solution is organized into directories named after the problem's ID and title, facilitating easy navigation and reference. This repository serves as a valuable resource for individuals aiming to enhance their problem-solving

Notifications You must be signed in to change notification settings

dinesh776/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Solutions

This repository contains solutions to various LeetCode problems that I have solved in different programming languages, primarily Java. Each solution is organized in its respective folder according to the problem number and name. The repository is a work in progress, and I will continue adding solutions as I solve more problems.

Repository Structure

Each problem is organized in a dedicated folder with the following structure:

  •   leetcode/
         | _ProblemNumber/ProblemName
             |_ SolutionFile.java
             |_ README.md
    
    
  • ProblemNumber.ProblemName: Each folder is named based on the LeetCode problem number and title for easier navigation.
  • SolutionFile.java: The main solution file for the problem, typically written in Java. Other languages may be added in the future.
  • README.md: A markdown file providing an explanation of the problem, approach, time complexity, and instructions on how to run the solution.

List of Solved Problems

Problem Number Problem Title Solution Link
118 Pascal's Triangle Link to Solution
1310 XOR Queries of a Subarray Link to Solution
268 Missing Number Link to Solution
448 Find All Numbers Disappeared in an Array Link to Solution
58 Length of Last word Link to Solution
27 Remove Elements from Array Link to Solution
26 Remove Elements from Sorted Array Link to Solution
35 Search Insert Position Link to Solution
28 Find the Index of the First Occurrence in a String Link to Solution
169 Majority Element Link to Solution
283 Move Zeroes Link to Solution
645 Set Mismatch Link to Solution
1089 Duplicate zeros Link to Solution
217 Contains Duplicate Link to Solution
3 Longest Substring Without Repeating Characters Link to Solution
7 Reverse a Integer Link to Solution
9 Palindrome Link to Solution
509 Fibonacci Number Link to Solution
125 Valid Palindrome Link to Solution
189 Rotate Array Link to Solution
485 Max Consecutive One's Link to Solution
136 Single Number Link to Solution
53 Maximum SubArray Link to Solution
2149 Rearrange Array Elements by Sign Link to Solution
31 Next Permutation Link to Solution
73 Set Matrix Zeroes Link to Solution
48 Rotate Image Link to Solution
54 Spiral Matrix Link to Solution
128 Longest Consecutive Sequence Link to Solution
560 Subarray Sum Equals K Link to Solution
229 Majority Element 2 Link to Solution
75 Sort Colors Link to Solution
121 Best Time to Buy and Sell Stock Link to Solution
15 3 Sum Link to Solution
18 4 Sum Link to Solution
56 Merge Intervals Link to Solution
88 Merge Sorted Arrays Link to Solution
152 Maximum Product Subarray Link to Solution
74 Search a 2D Matrix Link to Solution
287 Find The Duplicate Number Link to Solution
34 Find First and Last Position of Element in Sorted Array Link to Solution
153 Find Minimum in Rotated Sorted Array Link to Solution
33 Search in Rotated Sorted Array 1 Link to Solution
81 Search in Rotated Sorted Array 2 Link to Solution
540 Single Element in a Sorted Array Link to Solution
162 Find Peak Element Link to Solution
1539 Kth Missing Positive Number Link to Solution
1482 Minimum Number of Days to Make m Bouquets Link to Solution
1011 Capacity To Ship Packages Within D Days Link to Solution
410 Split Array Largest Sum Link to Solution
4 Median of Two Sorted Arrays Link to Solution
1901 Find a Peak Element II Link to Solution
875 Koko Eating Bananas Link to Solution
240 Search a 2D Matrix II Link to Solution
1283 Find the Smallest Divisor Given a Threshold Link to Solution
1903 Largest Odd Number in String Link to Solution
796 Rotate String Link to Solution
242 Valid Anagram Link to Solution
205 Isomorphic Strings Link to Solution
1614 Maximum Nesting Depth of the Parentheses Link to Solution
13 Roman to Integer Link to Solution
8 String to Integer (atoi) Link to Solution
50 Pow(x, n) Link to Solution
1342 Number of Steps to Reduce a Number to Zero Link to Solution
17 Letter Combinations of a Phone Number Link to Solution
5 Longest Palindromic Substring Link to Solution
14 Longest common prefix Link to Solution
1475 Final Prices With a Special Discount in a Shop Link to Solution
219 Contains Duplicate II Link to Solution
303 Range Sum Query - Immutable Link to Solution
1004 Max Consecutive Ones III Link to Solution
424 Longest Repeating Character Replacement Link to Solution
930 Binary Subarrays With Sum Link to Solution
1248 Count Number of Nice Subarrays Link to Solution
1358 Number of Substrings Containing All Three Characters Link to Solution
992 Subarrays with K Different Integers Link to Solution
228 Summary Ranges Link to Solution
349 Intersection of Two Arrays Link to Solution
350 Intersection of Two Arrays II Link to Solution
463 Island Perimeter Link to Solution
2559 Count Vowel Strings in Ranges Link to Solution
2270 Number of Ways to Split Array Link to Solution
496 Next Greater Element I Link to Solution
500 Keyboard Row Link to Solution
1769 Minimum Number of Operations to Move All Balls to Each Box Link to Solution
1408 String Matching in an Array Link to Solution
3042 Count Prefix and Suffix Pairs I Link to Solution
2185 Counting Words With a Given Prefix Link to Solution
506 Relative Ranks Link to Solution
561 Array Partition Link to Solution
599 Minimum Index Sum of Two Lists Link to Solution
20 Valid Parentheses Link to Solution
168 Excel Sheet Column Title Link to Solution
2429 Minimize XOR Link to Solution
69 Sqrt(x) Link to Solution
628 Maximum Product of Three Numbers Link to Solution
744 Find Smallest Letter Greater Than Target Link to Solution
1781 Sum of Beauty of All Substrings Link to Solution
414 Third Maximum Number Link to Solution
2 Add Two Numbers Link to Solution
119 Pascal's Triangle 2 Link to Solution
237 Delete Node in a Linked List Link to Solution
876 Middle Of The Linked List Link to Solution
206 Reverse Linked List Link to Solution
141 Linked List Cycle Link to Solution
142 Linked List Cycle 2 Link to Solution
234 Palindrome Linked List Link to Solution
328 Odd Even Linked List Link to Solution
2095 Delete The Middle Node Of A Linked List Link to Solution
160 Intersection of two Linked List Link to Solution
25 Reverse Nodes in a k-group Link to Solution
61 Rotate List Link to Solution
138 Copy List With Random Pointers Link to Solution
1992 Count Good Numbers Link to Solution
22 Generate Parentheses Link to Solution
19 Remove Nth Node From End of List Link to Solution
1021 Remove Outermost Parentheses Link to Solution
225 Implement Stack using Queues Link to Solution
232 Implement Queue using Stacks Link to Solution
155 Min Stack Link to Solution
151 Reverse Words in a String Link to Solution
39 Combination Sum Link to Solution
40 Combination Sum 2 Link to Solution
90 Subsets 2 Link to Solution
216 Combination Sum 3 Link to Solution
131 Palindrome Partitioning Link to Solution
79 WordSearch Link to Solution
51 N Queens Link to Solution
139 Word Break Link to Solution
37 Sudoko Solver Link to Solution
282 Expression Add Operators Link to Solution
912 Sort An Array Link to Solution
148 Sort List Link to Solution
451 Sort Characters By Frequency Link to Solution
503 Next Greater Element II Link to Solution
1752 Check if Array Is Sorted and Rotated Link to Solution
1838 Frequency of the Most Frequent Element Link to Solution
29 Divide Two Integers Link to Solution
2220 Minimum Bit Flips to Convert Number Link to Solution
204 Count Primes Link to Solution

More problem's will be added as I continue solving them on LeetCode.

How to Use

  1. Clone the repository:
    https://github.com/dinesh776/leetcode.git
    cd leetcode
  2. Navigate to the folder containing the specific problem solution you'd like to review:
    cd leetcode/SolutionFolderName(Replace with Preferred ame)
  3. Compile and run the solution:
    javac SolutionFile.java
    java SolutionFile

Folder N Each solution folder has detailed instructions on how to run the specific code for that problem.

Problem Categories

Here are some problem categories covered in this repository:

  • Array
  • Sorting (bubble,selection,insertion,cyclic,merge,quick,radix,bucket,heap)
  • Dynamic Programming
  • Linked List
  • Trees
  • Recursion
  • Bit Manipulation
  • Greedy Algorithms
  • Graphs
  • Mathematical Problems

This list will grow as I continue to solve problems across various topics.

How to Contribute

Feel free to contribute to this repository by:

  • Submitting solutions in other languages (like Python, C++, etc.).
  • Improving the existing solutions.
  • Adding test cases or edge cases.
  • Enhancing the documentation.

To contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b new-feature).
  3. Commit your changes (git commit -m 'Add new feature').
  4. Push the branch (git push origin new-feature).
  5. Submit a pull request.

Happy Coding!

About

The GitHub repository dinesh776/leetcode is a collection of solutions to various LeetCode problems, implemented in Java. Each solution is organized into directories named after the problem's ID and title, facilitating easy navigation and reference. This repository serves as a valuable resource for individuals aiming to enhance their problem-solving

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages