Welcome to my Data Structures and Algorithms repository! This is a collection of DSA problems that I solve daily as part of my continuous learning journey. Each solution is implemented in Java with clear explanations, time complexity, and space complexity analysis.
- ๐ Solve at least one DSA problem daily
- ๐ก Master core DSA concepts and patterns
- ๐ Prepare for technical interviews
- ๐ Track progress and improvement over time
- ๐ค Share knowledge with the developer community
Click to expand topics
| Topic | Easy | Medium | Hard | Total |
|---|---|---|---|---|
| ๐ Arrays | 15 | 12 | 5 | 32 |
| ๐ค Strings | 10 | 8 | 3 | 21 |
| ๐ Linked List | 8 | 10 | 4 | 22 |
| ๐ฒ Trees | 12 | 15 | 8 | 35 |
| ๐ Graphs | 5 | 12 | 10 | 27 |
| ๐งฎ Dynamic Programming | 8 | 18 | 15 | 41 |
| โก Recursion & Backtracking | 6 | 10 | 7 | 23 |
| ๐ Searching & Sorting | 10 | 8 | 4 | 22 |
| ๐ Stack & Queue | 8 | 6 | 2 | 16 |
| ๐๏ธ Heap & Hashing | 7 | 9 | 5 | 21 |
| ๐ฏ Greedy Algorithms | 5 | 8 | 6 | 19 |
| ๐ข Math & Bit Manipulation | 12 | 6 | 3 | 21 |
Total Problems Solved: 300+ ๐
| S.No | Problem Name | Difficulty | Topic | Solution | Time | Space |
|---|---|---|---|---|---|---|
| 001 | Array Utility | Arrays | View | O(n) | O(1) | |
| 002 | Buy And Sell Stock | Arrays | View | O(n) | O(1) | |
| 003 | Finding Leaders | Arrays | View | O(n) | O(n) | |
| 004 | Greater Then nBy2 | Arrays | View | O(n) | O(n) | |
| 005 | Longest Consecutive Sequence | Arrays | View | O(n) | O(n) | |
| 006 | Longest Subarray | Arrays | View | O(n) | O(n) | |
| 007 | Longest Sub Array | Arrays | View | O(n) | O(1) | |
| 008 | Maximum Sub Array | Arrays | View | O(n) | O(1) | |
| 009 | Missing Value Problem | Arrays | View | O(n) | O(1) | |
| 010 | Rearrange The Neg And Pos | Arrays | View | O(n) | O(n) | |
| 011 | Sorting | Arrays | View | O(n log n) | O(1) | |
| 012 | Sorting 0s 1s 2s | Arrays | View | O(n) | O(1) | |
| 013 | Two Sum | Arrays | View | O(n) | O(n) | |
| 013 | LinkedList | LinkedList | View | O(n) | O(n) |
๐ Note: Complete problem list can be found in individual topic folders.
- Java Development Kit (JDK) 17 or higher
- Any Java IDE (IntelliJ IDEA, Eclipse, VS Code) or text editor
git clone https://github.com/YOUR_USERNAME/DATA-STRUCTURES-AND-ALGORITHMS.git
cd DATA-STRUCTURES-AND-ALGORITHMS# Navigate to the specific problem directory
cd Arrays/Easy
# Compile the Java file
javac TwoSum.java
# Run the compiled class
java TwoSum- Open the project in your preferred IDE
- Navigate to the desired problem file
- Run the file directly from the IDE
Each solution file follows this structure:
/**
1. Brute
2. Better
3. Optimal
*/
public class Solution {
// Solution code here
public static void main(String[] args) {
// Test cases
}
}- LeetCode - Comprehensive problem set
- HackerRank - Structured learning paths
- Codeforces - Competitive programming
- GeeksforGeeks - Tutorials and problems
- InterviewBit - Interview preparation
- Java Documentation - Official Java docs
- Introduction to Algorithms (CLRS) - The classic textbook
- Cracking the Coding Interview - Interview prep guide
- Visualgo - Algorithm visualizations
- NeetCode - Clear explanations
- Abdul Bari - Algorithm concepts
- takeUforward - Comprehensive DSA series
- Back To Back SWE - Problem-solving techniques
Contributions are welcome! If you'd like to contribute:
- Fork this repository
- Create a new branch (
git checkout -b feature/add-new-problem) - Commit your changes (
git commit -m 'Add: [Problem Name]') - Push to the branch (
git push origin feature/add-new-problem) - Open a Pull Request
- โ Follow Java naming conventions
- โ Add comments explaining the approach
- โ Include time and space complexity
- โ Add test cases in the main method
- โ Use meaningful variable names
- โ Format code properly (indentation, spacing)
- Ensure your solution is optimal
- Add problem description as comments
- Include multiple test cases
- Follow the existing folder structure
- Update README.md if adding new topics