The Ultimate Collection of Data Structures & Algorithms Problems for Interview Preparation
This repository contains a carefully curated collection of the most important and logic-building DSA problems specifically focusing on Arrays, Strings, and Linked Lists in Java. These problems are selected from top-tier repositories and are designed to prepare you for technical interviews at companies like Reqpedia and other top-tier organizations.
This collection emphasizes:
- Quality over Quantity: Only the most important and frequently asked problems
- Pattern Mastery: Comprehensive coverage of essential algorithmic patterns
- Logic Building: Problems that enhance problem-solving and analytical thinking
- Interview Readiness: Real-world problems asked in technical interviews
- Java Implementation: All solutions and examples are in Java
Essential patterns covered:
- Two Pointers, Sliding Window, Prefix/Suffix Sums
- Searching, Sorting, Binary Search variations
- Kadane's Algorithm, Subarray problems
- Array rotations, rearrangements, merging
- Frequency counting, majority elements
Essential patterns covered:
- Palindrome detection and manipulation
- Substring search and pattern matching (KMP, Rabin-Karp)
- Sliding window techniques
- Character counting and anagram detection
- String parsing and validation
- Edit distance and dynamic programming
Essential patterns covered:
- Floyd's Cycle Detection Algorithm
- Linked List reversal and manipulation
- Two pointer techniques
- Merging and sorting operations
- Deep copying and complex operations
- Intersection and palindrome detection
| # | Title | Difficulty | Pattern | Source Link | Notes | Solve Here |
|---|---|---|---|---|---|---|
| 1 | Two Sum | Medium | Hash Table + Array | GitHub | Foundation problem for hash table usage | LeetCode |
| 2 | 3Sum | Medium | Two Pointers + Arrays | GitHub | Classic two-pointer technique, avoid duplicates | LeetCode |
| 3 | Trapping Rain Water | Hard | Two Pointers + Arrays | GitHub | Advanced two-pointer, multiple approaches | LeetCode |
| 4 | Maximum Subarray | Medium | Kadane's Algorithm | GitHub | Essential DP pattern for subarray problems | LeetCode |
| 5 | Container With Most Water | Medium | Two Pointers + Arrays | GitHub | Greedy two-pointer approach | LeetCode |
| 6 | Merge Intervals | Medium | Interval Merging | GitHub | Critical for interval-based problems | LeetCode |
| 7 | Rotate Array | Medium | Array Rotation | GitHub | Multiple rotation techniques | LeetCode |
| 8 | Search in Rotated Sorted Array | Medium | Binary Search + Arrays | GitHub | Advanced binary search variation | LeetCode |
| 9 | First Missing Positive | Hard | Array Manipulation | GitHub | In-place array modification technique | LeetCode |
| 10 | Next Permutation | Medium | Array Rearrangement | GitHub | Complex array manipulation logic | LeetCode |
| 11 | Longest Palindromic Substring | Medium | String + Palindrome | GitHub | Expand around center technique | LeetCode |
| 12 | Longest Substring Without Repeating Characters | Medium | Sliding Window + String | GitHub | Classic sliding window pattern | LeetCode |
| 13 | Minimum Window Substring | Hard | Sliding Window + String | GitHub | Advanced sliding window technique | LeetCode |
| 14 | Group Anagrams | Medium | Hash Table + String | GitHub | String sorting and grouping | LeetCode |
| 15 | Valid Palindrome | Easy | Two Pointers + String | GitHub | String normalization and validation | LeetCode |
| 16 | Implement strStr() | Medium | KMP Algorithm + String | GitHub | Pattern matching algorithms | LeetCode |
| 17 | Longest Common Prefix | Easy | String Manipulation | GitHub | String comparison techniques | LeetCode |
| 18 | String to Integer (atoi) | Medium | String Parsing | GitHub | Complex string parsing and validation | LeetCode |
| 19 | Palindrome Partitioning | Medium | Backtracking + String | GitHub | Backtracking with palindrome validation | LeetCode |
| 20 | Edit Distance | Hard | Dynamic Programming + String | GitHub | Classic DP for string transformation | LeetCode |
| 21 | Linked List Cycle | Easy | Floyd's Algorithm + LinkedList | GitHub | Essential cycle detection technique | LeetCode |
| 22 | Linked List Cycle II | Medium | Floyd's Algorithm + LinkedList | GitHub | Advanced cycle detection with position | LeetCode |
| 23 | Reverse Linked List II | Medium | LinkedList Reversal | GitHub | Partial linked list reversal | LeetCode |
| 24 | Merge Two Sorted Lists | Easy | LinkedList Merging | GitHub | Foundation for merge operations | LeetCode |
| 25 | Remove Nth Node From End of List | Medium | Two Pointers + LinkedList | GitHub | One-pass two-pointer technique | LeetCode |
| 26 | Intersection of Two Linked Lists | Easy | Two Pointers + LinkedList | GitHub | Elegant intersection detection | LeetCode |
| 27 | Add Two Numbers | Medium | LinkedList Arithmetic | GitHub | Digit-by-digit addition with carry | LeetCode |
| 28 | Copy List with Random Pointer | Medium | Deep Copy + LinkedList | GitHub | Complex linked list deep copying | LeetCode |
| 29 | Merge k Sorted Lists | Hard | Divide & Conquer + LinkedList | GitHub | Advanced merging with heap/divide-conquer | LeetCode |
| 30 | Sort List | Medium | Merge Sort + LinkedList | GitHub | Implementing merge sort on linked list | LeetCode |
Every essential algorithmic pattern is covered through carefully selected problems that build upon each other.
All problems are frequently asked in technical interviews at top companies including Google, Amazon, Microsoft, and startups like Reqpedia.
Problems are arranged to build your understanding from fundamental concepts to advanced techniques.
Each problem is chosen for its ability to enhance logical thinking and problem-solving skills.
All problems are sourced from the most reputable and well-maintained repositories:
- doocs/leetcode: 34,429+ stars, exceptional quality and organization
- Blankj/awesome-java-leetcode: 8,714+ stars, Java-focused solutions
- LeetCode Official: Primary problem source with comprehensive test cases
- Start with the Pattern: Understand the underlying pattern for each problem category
- Read the Problem Statement: Click on "Solve Here" links to read full problem descriptions
- Study the Source Code: Visit GitHub links to see multiple solution approaches
- Practice Implementation: Implement solutions in your preferred IDE
- Analyze Complexity: Understand time and space complexity for each approach
- Master Variations: Practice similar problems to reinforce patterns
Start with these foundational problems to build core understanding.
Tackle these problems after mastering the basics.
Challenge yourself with these complex problems requiring deep algorithmic knowledge.
- Pattern Recognition: Focus on recognizing which pattern applies to new problems
- Time Management: Practice solving problems within interview time constraints
- Code Quality: Write clean, readable code with proper variable names
- Edge Cases: Always consider and handle edge cases
- Optimization: Start with brute force, then optimize step by step
- Communication: Practice explaining your thought process clearly
This is a curated collection focused on quality over quantity. While we welcome suggestions for critical problems that may be missing, please ensure any proposed additions:
- Are frequently asked in interviews
- Represent unique algorithmic patterns
- Provide significant learning value
- Have high-quality solutions available
- doocs/leetcode: Comprehensive multi-language solutions
- Blankj/awesome-java-leetcode: Java-specific implementations
- LeetCode Patterns: Pattern-based problem solving guides
Happy Coding! 🚀 Master these 30 problems and you'll be well-prepared for any Array, String, or LinkedList question in your technical interviews.