Skip to main content

CLI tool that analyzes Python interview solutions

Project description

๐Ÿš€ InterviewPrep

Python License Status Tests

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.

  1. Fork the repository.
  2. Create a new branch.
  3. Commit your changes.
  4. Open a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License.


๐Ÿ‘จโ€๐Ÿ’ป Author

Doddi Yaswanth


โญ If you like this project, consider giving it a star on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

interviewprep-0.1.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

interviewprep-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

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

Hashes for interviewprep-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a4a914e3718ab51b20eb07d66b53995d45d906ac3c4cc2cd0133b436421ca685
MD5 39b2a95ff8bcc9e4be0757f6e43cce9b
BLAKE2b-256 4775768ec77c0e964724d78d8d25dbd6be3100cbcce9febd91c0ca118fa45372

See more details on using hashes here.

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

Hashes for interviewprep-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 65f78ea459d7073541182180d8bef3c7133e5479c3feb43247a9e45b7d9b5a45
MD5 4f2272e4e50b03d23ee8fb081b87c6d6
BLAKE2b-256 4d09b781f43338f28b9fa7f35b912e3be0bd487a378b7c25acdf332b6f77eaf8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page