Skip to content

Magken/Leetcode_Solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–ΌοΈ LeetCode Screenshot OCR Solver

This project automates the process of extracting, solving, and explaining LeetCode-style coding problems from desktop screenshots using OCR and OpenAI GPT models.


πŸ“Œ Features

  • βœ… Detects open desktop windows and takes a screenshot of a selected one
  • πŸ–ΌοΈ Stores screenshots in a dedicated screen_shots/ folder
  • πŸ” Uses Tesseract OCR to extract text from screenshots
  • πŸ“ Saves parsed text into the parsed_texts/ folder
  • πŸ€– Sends the extracted text to OpenAI GPT-4o via API to:
    • Identify any LeetCode-style problem
    • Explain the problem in natural language
    • Provide a step-by-step solution with code
  • πŸ“„ Saves the GPT-generated solution in Markdown format under explained_solns/

🧠 Example Use Case

Imagine you have a coding challenge open on your screen, and you want:

  1. To extract the question text from a screenshot
  2. To get an immediate explanation and solution from GPT

This project automates that entire flow.


πŸ“ Directory Structure

. β”œβ”€β”€ screen_shots/ # Screenshots of captured windows β”œβ”€β”€ parsed_texts/ # Raw OCR text extracted from screenshots β”œβ”€β”€ explained_solns/ # Markdown solutions from OpenAI GPT β”œβ”€β”€ .env # Your OpenAI API key (OPENAI_API_KEY="sk-...") β”œβ”€β”€ notebook.ipynb # The Jupyter Notebook to run everything β”œβ”€β”€ requirements.txt # Dependency list └── README.md # You're here :)


πŸ› οΈ Requirements

Make sure the following tools and Python packages are installed:

pip install -r requirements.txt

About

LeetCode Screenshot OCR Solver

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published