⭐ Star this repo if it helps you crack your interview!
📊 80+ curated problems | Organized topic-wise | Interview-focused patterns
A comprehensive collection of Data Structures and Algorithms problems organized by topic. This repository contains solutions to classic and interview-focused DSA questions covering fundamental to advanced concepts.
Completion: 100% (80 / 80 problems)
| Topic | Easy | Medium | Hard | Total |
|---|---|---|---|---|
| 01. Basic and maths | 5 | 3 | 0 | 8 |
| 02. Array and prefix_sum | 6 | 9 | 2 | 17 |
| 03. Strings | 3 | 5 | 1 | 9 |
| 04. Hashing | 1 | 3 | 0 | 4 |
| 05. Two pointers & Sliding window | 1 | 2 | 0 | 3 |
| 06. Stack & Queue | 1 | 2 | 1 | 4 |
| 07. Linked List | 2 | 3 | 0 | 5 |
| 08. Trees | 3 | 5 | 2 | 10 |
| 09. Binary Search | 1 | 3 | 1 | 5 |
| 10. Greedy Problems | 2 | 3 | 1 | 6 |
| 11. Dynamic Programming | 2 | 4 | 3 | 9 |
| Total | 27 | 42 | 11 | 80 |
| Problem | Topic | Difficulty | Solution |
|---|---|---|---|
| Two Sum | Array | Easy | View |
| Kadane's Algorithm | Array | Medium | View |
| Valid Parentheses | Stack (Strings) | Easy | View |
| Binary Search | Binary Search | Easy | View |
| Reverse Linked List | Linked List | Easy | View |
These problems represent common interview patterns seen in companies such as:
• Google • Amazon • Microsoft • Meta • Apple • and other tech companies
Core mathematical concepts and number theory problems
- LCM & GCD calculations
- XOR properties and operations
- Power and modular exponentiation
- Prime number finding
- Perfect squares
Array manipulation and prefix sum techniques
- Two Sum and 3Sum problems
- Maximum subarray problems
- Prefix sum optimization
- Array rotation and equilibrium
- Product of array elements
String manipulation and pattern matching
- Parenthesis validation
- Substring problems (longest, minimum window)
- Palindrome detection and formation
- Anagram grouping
- Character frequency analysis
Hash-based data structures and techniques
- Frequency counting
- Distinct element counting
- Custom data structure design
- Hash-based LCS
Efficient pointer and window techniques
- Two sum with sorted arrays
- Maximum elements in sliding window
- Consecutive ones and window operations
Stack and queue-based problems
- Next greater element
- Minimum stack operations
- Largest rectangle in histogram
- Rotten oranges (BFS with queue)
Linked list operations and algorithms
- Linked list reversal
- Loop detection
- Merge sorted lists
- Middle element and node removal
Tree traversal and tree-based problems
- In-order, Pre-order, Post-order traversals
- Level order traversal
- Tree height and diameter
- Lowest Common Ancestor (LCA)
- Path sum and maximum path
- Serialize and deserialize
Binary search and search space optimization
- Standard binary search
- Sorted and rotated array search
- Peak element finding
- Aggressive cows and page allocation problems
Greedy algorithm applications
- Monster battle strategy
- Minimum platforms required
- Job sequencing
- Merge intervals
- Gas station
- Fractional knapsack
Dynamic programming techniques and optimization
- Fibonacci and climbing stairs
- Coin change problem
- Longest Increasing Subsequence (LIS)
- Longest Common Subsequence (LCS)
- 0/1 Knapsack
- Partition equal sum subset
- Maximum product subarray
- Edit distance
Each folder contains Python solutions organized by problem name. Problems marked with _IMP suffix indicate important interview questions.
├── 01. Basic and maths/
├── 02. Array and prefix_sum/
├── 03. Strings/
├── 04. Hashing/
├── 05. Two pointers & Sliding window/
├── 06. Stack & Queue/
├── 07. Linked List/
├── 08. Trees/
├── 09. Binary Search/
├── 10. Greedy Problems/
├── 11. Dynamic Programming/
├── practice.py
- Clone the repository
git clone https://github.com/Achal13jain/Topic-wise-DSA-Imp-questions-Python.git
cd Topic-wise-DSA-Imp-questions-Python- Navigate to a topic folder based on what you want to practice
- Read the solution to understand the approach and algorithm
- Note the time & space complexity (usually in function docstring or comments)
- Try implementing yourself before reading the solution
- Focus on _IMP problems for quick interview prep
_IMPsuffix: Important interview questions - prioritize these for interview prep- Regular files: Good for learning and building solid fundamentals
In this repository:
- Time Complexity: How fast the algorithm runs (e.g., O(n), O(n log n), O(n²))
- Space Complexity: Extra memory used (e.g., O(1), O(n))
- Look for comments in solutions mentioning these complexities
- Understand before coding - Read the problem and understand what's needed
- Know your complexity - Always be aware of time/space trade-offs
- Practice multiple approaches - One problem can be solved many ways
- Review _IMP problems - These appear frequently in interviews
- Write test cases - Verify edge cases (empty inputs, single elements, etc.)
- Learn the pattern - Each problem teaches a technique applicable elsewhere
1. Basic and Maths (foundation)
↓
2. Array and Prefix Sum (core data structure)
↓
3. Strings (pattern matching)
↓
4. Hashing (problem optimization)
5. Two Pointers & Sliding Window (technique mastery)
↓
6. Stack & Queue (advanced data structures)
↓
7. Linked List (pointer manipulation)
8. Trees (recursive thinking)
↓
9. Binary Search (search optimization)
↓
10. Greedy Problems (optimization strategy)
↓
11. Dynamic Programming (problem solving paradigm)
Focus on all _IMP problems across all topics in 2-3 weeks. They cover 80% of interview questions.
- Total Problems: 80+
- Interview Problems: 20+ (marked with _IMP)
- Topics: 11
- Code Lines: 3000+
- Language: Python 3
- Data Structures: Arrays, Strings, Hash Maps, Stacks, Queues, Linked Lists, Trees
- Algorithms: Sorting, Searching, Dynamic Programming, Greedy, BFS, DFS
- Techniques: Two Pointers, Sliding Window, Prefix Sum, Recursion, Memoization
- Array manipulation and optimization
- String processing and pattern matching
- Efficient searching (Binary Search)
- Tree and Graph traversal
- Recursive problem solving
- Optimization techniques
- Edge case handling
Found an issue or want to add more solutions? Feel free to:
- Fork the repository
- Add or improve solutions
- Submit a pull request
See CONTRIBUTING.md for more details.
This repository is open source and available under the MIT License - feel free to use it for learning and interview prep.
If you found this repository helpful, please consider giving it a ⭐ Star!
Achal Jain
GitHub: https://github.com/Achal13jain
Last Updated: February 2026
Useful for technical interview preparation and strengthening DSA fundamentals