Skip to content

justinliu1308/create_python_file_leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate Local Python File for LeetCode Problems

For online LeetCode users who wish to work on and save code offline, this script reads a URL with the specific problem and:

  • Queries problem information from LeetCode (LeetCode uses GraphQL as its API query language)
  • Creates a local Python file with the appropriate file name if file does not already exist
  • Formats and populates the problem information
  • Launches the new file to be worked on (Windows function only)

Usage:

  1. In the terminal, navigate to the directory where you intend to generate the new Python file
  2. Acquire the full URL of the LeetCode problem to use as argument (ex: 'https://leetcode.com/problems/same-tree/' or 'https://leetcode.com/problems/same-tree/description/')
  3. Run main.py (ex: python main.py https://leetcode.com/problems/same-tree/description/)

Sample LeetCode problem from website: alt text

Sample output file created: alt text

About

Automates the process of creating and populating a local Python file to save LeetCode problems

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages