Skip to content

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Python DSA Interview Prep

Python Problems Topics License

⭐ Star this repo if it helps you crack your interview!

98 curated problems · 15 topics · Interview-focused patterns · Python 3


📖 Guides

Resource Purpose
🌐 Visual Index Browse all problems in a filterable UI
PATTERNS.md Signal → technique cheat-sheet — "which pattern do I use?"
DATA_STRUCTURES.md Requirement → data-structure chooser

✅ Progress Tracker

Completion: 100% (98 / 98 problems)

# Topic Easy Medium Hard Total
01 Basic and Maths 5 3 0 8
02 Array and Prefix Sum 8 9 0 17
03 Strings 4 4 1 9
04 Hashing 1 3 0 4
05 Two Pointers & Sliding Window 1 1 1 3
06 Stack & Queue 0 3 1 4
07 Linked List 3 2 0 5
08 Trees 5 2 2 9
09 Binary Search 1 2 2 5
10 Greedy Problems 1 5 0 6
11 Dynamic Programming 2 8 1 11
12 Graphs 2 5 0 7
13 Heap & Priority Queue 0 2 2 4
14 Backtracking 0 4 1 5
15 Trie 0 1 0 1
Total 33 54 11 98

Note: TreeNode.py in the Trees folder is a shared helper class, not a problem.
Counts verified programmatically: 98 solution files across 15 topic folders.


📚 Topics Covered

1. Basic and Maths

LCM & GCD · XOR properties · Power and modular exponentiation · Sieve of Eratosthenes · Perfect squares

2. Array and Prefix Sum

Two Sum · 3Sum · Kadane's (max subarray) · Prefix sum · Product of array except self · Merge sorted arrays · Move zeroes

3. Strings

Valid parentheses · Longest substring without repeating · Minimum window substring · Longest palindromic substring · Group anagrams

4. Hashing

Frequency counting · Longest common subsequence (hash) · Custom data structure design · Count distinct elements in window

5. Two Pointers & Sliding Window

Two sum (sorted) · Max element in sliding window · Maximum consecutive ones

6. Stack & Queue

Next greater element · Min stack · Largest rectangle in histogram · Rotten Oranges (multi-source BFS)

7. Linked List

Reverse · Loop detection (Floyd's) · Merge sorted lists · Middle element · Remove nth from end

8. Trees

In/Pre/Post-order traversal · Level-order · Height · Diameter · LCA · Path sum · Max path sum · Subtree check · Serialize & Deserialize

9. Binary Search

Standard binary search · Search in rotated sorted array · Book allocation · Aggressive cows · Peak element

10. Greedy Problems

Monster battle · Minimum platforms · Job sequencing · Merge intervals · Gas station · Fractional knapsack

11. Dynamic Programming

Fibonacci · Climbing stairs · Coin change · LIS · LCS · 0/1 Knapsack · Partition equal sum · Max product subarray · Edit distance · Unique paths · House robber

12. Graphs

BFS template · DFS (recursive + iterative) · Number of Islands · Clone Graph · Course Schedule (topological sort) · Network Delay Time (Dijkstra) · Number of Provinces (Union-Find)

13. Heap & Priority Queue

Kth largest element · Top K frequent elements · Merge K sorted lists · Find median from data stream

14. Backtracking

Subsets · Permutations · Combination sum · N-Queens · Word search

15. Trie

Implement Trie (prefix tree)


🗂️ Repository Structure

├── 01. Basic and maths/        (8 problems)
├── 02. Array and prefix_sum/   (17 problems)
├── 03. Strings/                (9 problems)
├── 04. Hashing/                (4 problems)
├── 05. Two pointers & Sliding window/  (3 problems)
├── 06. Stack & Queue/          (4 problems)
├── 07. Linked List/            (5 problems)
├── 08. Trees/                  (9 problems + TreeNode.py helper)
├── 09. Binary Search/          (5 problems)
├── 10. Greedy Problems/        (6 problems)
├── 11. Dynamic Programming/    (11 problems)
├── 12. Graphs/                 (7 problems)
├── 13. Heap and Priority Queue/ (4 problems)
├── 14. Backtracking/           (5 problems)
├── 15. Trie/                   (1 problem)
├── index.html                  — filterable visual index
├── PATTERNS.md                 — signal → technique cheat-sheet
└── DATA_STRUCTURES.md          — requirement → data-structure chooser

🎯 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
  2. Navigate to a topic folder and open any .py file.
  3. Read or run the solution — some files include a if __name__ == "__main__": sample block, and the rest can be tested by calling the function/class directly.
  4. Focus on _IMP files for quick interview prep — these are the priority revision picks in this repo.
  5. Read PATTERNS.md to recognise which technique to apply when you see a problem signal.

💡 Problem Markers

  • _IMP — Important priority picks for interview revision.
  • Regular files — Core problems for building solid fundamentals.

📖 Recommended Learning Path

Beginner

Basic and Maths → Array & Prefix Sum → Strings → Hashing

Intermediate

Two Pointers & Sliding Window → Stack & Queue → Linked List

Advanced

Trees → Binary Search → Greedy → Dynamic Programming
→ Graphs → Heap & Priority Queue → Backtracking → Trie

Fast-track Interview Prep (2–3 weeks)

Focus on all _IMP files across every topic. They cover the patterns most likely to appear in a 45-minute interview round.


🤝 Contributing

Found an issue or want to improve a solution?

  1. Fork the repository
  2. Add or improve solutions (match the existing file format)
  3. Submit a pull request

See CONTRIBUTING.md for more details.


📝 License

MIT — free to use for learning and interview preparation.


👨‍💻 Author

Achal Jain · github.com/Achal13jain


Last updated: June 2026

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