LeetCode Solver Bot is an automated tool designed to solve LeetCode problems using AI-powered code generation. It interacts with the LeetCode platform to fetch problems, generate solutions, submit them, and handle debugging if necessary.
- Automated login to LeetCode using GitHub authentication
- Fetching unsolved LeetCode problems
- AI-powered solution generation using GPT-4
- Automated solution submission and testing
- Debugging capabilities for failed submissions
- Support for multiple programming languages (currently focused on Python)
solver_dev.py
: Main script containing all the core functionality.env
: Environment variables (not tracked in git)requirements.txt
: List of dependenciesinstall_dependencies.sh
: Script to install dependencies
-
Clone the repository:
git clone https://github.com/yourusername/LeetCode-Solver-Bot.git cd LeetCode-Solver-Bot
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.env
file in the root directory with the following content:LEETCODE_USERNAME=your_github_username LEETCODE_PASSWORD=your_github_password OPENAI_API_KEY=your_openai_api_key
To start the LeetCode Solver Bot, run:
python solver.py
The bot will automatically:
- Log in to LeetCode
- Find the next unsolved problem
- Generate a solution using GPT-4
- Test the solution
- Submit the solution if tests pass
- Debug and retry if the solution fails
Contributions to the LeetCode Solver Bot are welcome!
This tool is for educational purposes only. Please use it responsibly and in accordance with LeetCode's terms of service.