Skip to content

Achal13jain/Topic-wise-DSA-Imp-questions-Python

🎯 Python DSA Interview Prep - 80+ Problems

Python Problems Topics License

⭐ 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.

✅ Progress Tracker

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 Index (Quick Navigation)

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

🏢 Problems Asked At

These problems represent common interview patterns seen in companies such as:

• Google • Amazon • Microsoft • Meta • Apple • and other tech companies

📚 Topics Covered

1. Basic and Maths

Core mathematical concepts and number theory problems

  • LCM & GCD calculations
  • XOR properties and operations
  • Power and modular exponentiation
  • Prime number finding
  • Perfect squares

2. Array and Prefix Sum

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

3. Strings

String manipulation and pattern matching

  • Parenthesis validation
  • Substring problems (longest, minimum window)
  • Palindrome detection and formation
  • Anagram grouping
  • Character frequency analysis

4. Hashing

Hash-based data structures and techniques

  • Frequency counting
  • Distinct element counting
  • Custom data structure design
  • Hash-based LCS

5. Two Pointers & Sliding Window

Efficient pointer and window techniques

  • Two sum with sorted arrays
  • Maximum elements in sliding window
  • Consecutive ones and window operations

6. Stack & Queue

Stack and queue-based problems

  • Next greater element
  • Minimum stack operations
  • Largest rectangle in histogram
  • Rotten oranges (BFS with queue)

7. Linked List

Linked list operations and algorithms

  • Linked list reversal
  • Loop detection
  • Merge sorted lists
  • Middle element and node removal

8. Trees

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

9. Binary Search

Binary search and search space optimization

  • Standard binary search
  • Sorted and rotated array search
  • Peak element finding
  • Aggressive cows and page allocation problems

10. Greedy Problems

Greedy algorithm applications

  • Monster battle strategy
  • Minimum platforms required
  • Job sequencing
  • Merge intervals
  • Gas station
  • Fractional knapsack

11. Dynamic Programming

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

🗂️ Repository Structure

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

🎯 How to Use

  1. Clone the repository
git clone https://github.com/Achal13jain/Topic-wise-DSA-Imp-questions-Python.git
cd Topic-wise-DSA-Imp-questions-Python
  1. Navigate to a topic folder based on what you want to practice
  2. Read the solution to understand the approach and algorithm
  3. Note the time & space complexity (usually in function docstring or comments)
  4. Try implementing yourself before reading the solution
  5. Focus on _IMP problems for quick interview prep

💡 Problem Markers

  • _IMP suffix: Important interview questions - prioritize these for interview prep
  • Regular files: Good for learning and building solid fundamentals

🔍 Complexity Notation

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

🚀 Best Practices & Tips

  1. Understand before coding - Read the problem and understand what's needed
  2. Know your complexity - Always be aware of time/space trade-offs
  3. Practice multiple approaches - One problem can be solved many ways
  4. Review _IMP problems - These appear frequently in interviews
  5. Write test cases - Verify edge cases (empty inputs, single elements, etc.)
  6. Learn the pattern - Each problem teaches a technique applicable elsewhere

📖 Recommended Learning Path

👶 For Beginners

1. Basic and Maths (foundation)
   ↓
2. Array and Prefix Sum (core data structure)
   ↓
3. Strings (pattern matching)
   ↓
4. Hashing (problem optimization)

🏃 For Intermediate

5. Two Pointers & Sliding Window (technique mastery)
   ↓
6. Stack & Queue (advanced data structures)
   ↓
7. Linked List (pointer manipulation)

🚀 For Advanced

8. Trees (recursive thinking)
   ↓
9. Binary Search (search optimization)
   ↓
10. Greedy Problems (optimization strategy)
   ↓
11. Dynamic Programming (problem solving paradigm)

🎯 For Interview Prep (Fast Track)

Focus on all _IMP problems across all topics in 2-3 weeks. They cover 80% of interview questions.


📊 Repository Statistics

  • Total Problems: 80+
  • Interview Problems: 20+ (marked with _IMP)
  • Topics: 11
  • Code Lines: 3000+
  • Language: Python 3

🛠️ Tools & Concepts Used

  • 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

💪 Common Interview Topics Covered

  • 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

🤝 Contributing

Found an issue or want to add more solutions? Feel free to:

  1. Fork the repository
  2. Add or improve solutions
  3. Submit a pull request

See CONTRIBUTING.md for more details.

📝 License

This repository is open source and available under the MIT License - feel free to use it for learning and interview prep.

📧 Feedback

If you found this repository helpful, please consider giving it a ⭐ Star!


👨‍💻 Author

Achal Jain
GitHub: https://github.com/Achal13jain


Last Updated: February 2026

Useful for technical interview preparation and strengthening DSA fundamentals

About

Comprehensive Topic-Wise DSA Problems in Python - Practice code for Data Structures and Algorithms

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages