CLI tool that analyzes Python interview solutions
Project description
๐ InterviewPrep
InterviewPrep is a lightweight Python CLI tool that analyzes Python interview solutions using Python's Abstract Syntax Tree (AST).
Instead of simply running code, InterviewPrep understands the coding technique used and provides an interview-oriented report including:
- Detected Algorithm
- Estimated Time Complexity
- Estimated Space Complexity
- Coding Pattern
- Related LeetCode Problems
- Interview Questions
The goal of this project is to help students understand why a solution works instead of only checking whether it is correct.
โจ Features
Currently InterviewPrep supports automatic detection of:
- โ HashMap
- โ Set
- โ Binary Search
- โ Recursion
- โ Sliding Window
- โ Two Pointers
- โ Prefix Sum
- โ Breadth First Search (BFS)
- โ Depth First Search (DFS)
- โ Dynamic Programming
It also provides:
- AST Based Code Analysis
- Pattern Detection
- Time Complexity Estimation
- Space Complexity Estimation
- Related Interview Problems
- Interview Questions
- Beginner Friendly CLI
๐ Project Structure
InterviewPrep/
โโโ interviewprep/
โ โโโ __init__.py
โ โโโ __main__.py
โ โโโ analyzer.py
โ โโโ cli.py
โ โโโ detector.py
โ โโโ complexity.py
โ โโโ pattern.py
โ โโโ report.py
โ โโโ knowledge/
โ โโโ hashmap.json
โ โโโ set.json
โ โโโ binary_search.json
โ โโโ recursion.json
โ โโโ sliding_window.json
โ โโโ two_pointers.json
โ โโโ prefix_sum.json
โ โโโ bfs.json
โ โโโ dfs.json
โ โโโ dynamic_programming.json
โ
โโโ examples/
โ
โโโ tests/
โ
โโโ README.md
โโโ LICENSE
โโโ pyproject.toml
โโโ requirements.txt
โ๏ธ Installation
Clone the repository
git clone https://github.com/doddiyaswanth/InterviewPrep.git
Move into the project
cd InterviewPrep
Install the package
pip install -e .
โถ๏ธ Usage
Analyze a Python solution
python -m interviewprep examples/twosum.py
Another example
python -m interviewprep examples/two_pointers.py
You can analyze any Python solution file.
Example:
python -m interviewprep my_solution.py
๐ป Sample Output
========================================
InterviewPrep Report
========================================
For Loops : 1
While Loops : 0
Detected Topics
โ HashMap
Estimated Time Complexity
O(n)
Estimated Space Complexity
O(n)
Related Problems
โข Contains Duplicate
โข Top K Frequent Elements
โข Group Anagrams
Interview Questions
1. Why did you choose a HashMap?
2. Can you solve this without extra space?
3. Why is lookup O(1)?
Detected Patterns
โ Single Pass
Estimated Overall Time Complexity
O(n)
========================================
๐งช Running Tests
Run all tests
pytest
Expected Output
==========================
10 passed in 0.05s
==========================
๐ Supported Algorithms
| Algorithm | Supported |
|---|---|
| HashMap | โ |
| Set | โ |
| Binary Search | โ |
| Recursion | โ |
| Sliding Window | โ |
| Two Pointers | โ |
| Prefix Sum | โ |
| BFS | โ |
| DFS | โ |
| Dynamic Programming | โ |
๐๏ธ How It Works
InterviewPrep uses Python's AST (Abstract Syntax Tree) to analyze source code.
Workflow:
Python File
โ
โผ
AST Parser
โ
โผ
Topic Detector
โ
โผ
Pattern Detector
โ
โผ
Complexity Estimator
โ
โผ
Knowledge Base
โ
โผ
Interview Report
๐บ๏ธ Roadmap
Version 1.0
- CLI Tool
- AST Analysis
- 10 DSA Topic Detection
- Complexity Estimation
- Pattern Detection
- JSON Knowledge Base
Future Versions
- More DSA Topics
- HTML Report
- PDF Report
- Directory Analysis
- Better Complexity Estimation
- PyPI Package
๐ค Contributing
Contributions are welcome.
- Fork the repository.
- Create a new branch.
- Commit your changes.
- Open a Pull Request.
๐ License
This project is licensed under the MIT License.
๐จโ๐ป Author
Doddi Yaswanth
- GitHub: https://github.com/doddiyaswanth
โญ If you like this project, consider giving it a star on GitHub.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file interviewprep-0.1.0.tar.gz.
File metadata
- Download URL: interviewprep-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4a914e3718ab51b20eb07d66b53995d45d906ac3c4cc2cd0133b436421ca685
|
|
| MD5 |
39b2a95ff8bcc9e4be0757f6e43cce9b
|
|
| BLAKE2b-256 |
4775768ec77c0e964724d78d8d25dbd6be3100cbcce9febd91c0ca118fa45372
|
File details
Details for the file interviewprep-0.1.0-py3-none-any.whl.
File metadata
- Download URL: interviewprep-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65f78ea459d7073541182180d8bef3c7133e5479c3feb43247a9e45b7d9b5a45
|
|
| MD5 |
4f2272e4e50b03d23ee8fb081b87c6d6
|
|
| BLAKE2b-256 |
4d09b781f43338f28b9fa7f35b912e3be0bd487a378b7c25acdf332b6f77eaf8
|