Skip to content

ixora-0/leetcode-notebook-generator

Repository files navigation

leetcode-notebook-generator

A Python script to simplify LeetCode problem-solving by generating a Jupyter Notebook template from problem URLs.

‼️Method

This uses selenium to scrape from LeetCode. Since there's no LeetCode API that we could use, and headless requests don't give us the whole site, we have to launch a browser instance using selenium and get the information about the problem through that browser.

Installation

  1. Clone the repository:
    git clone https://github.com/ixora-0/leetcode-notebook-generator.git
    cd leetcode-notebook-generator
  2. Install dependencies

Using poetry

poetry install

Using pip

pip install -r requirements.txt

Usage

Using poetry

poetry run generate <url> -d <path>

Without poetry

python -m leetcode_notebook_generator <url> -d <path>

Replace <url> with the URL of the LeetCode problem you want to generate a Jupyter Notebook for. Replace <path> with th edestination folder, default is ./output/.

Example

poetry run generate https://leetcode.com/problems/two-sum/ -d ./sample_output/

or

python -m leetcode_notebook_generator https://leetcode.com/problems/two-sum/ -d ./sample_output/

This will generate a Jupyter Notebook with a template for the Two Sum problem. Example Notebook

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0). See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published