Eurus-Holmes / leetcode-program

LeetCode practice task generator.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LeetCode Program

Build Status License: GPL v3 PullRequest

I created this as a productive tool for practicing LeetCode online judge. It is mainly for Google's interview in the near future. It aims to use the powerful utilities of Travis-CI and GitHub to do the boring things: choosing which questions to solve, creating issue for today's task...

My Solutions

Feel free to check my solutions of LeetCode questions on https://chenfeiyang.top/categories/Leetcode/. :D

Setup

Fork and Clone

Just fork and clone this repository.

Project Configure

To appease your custom needs, there are several constants in core/constant.py that could be set.

  • USERNAME: You HAVE TO change this to your GitHub account, otherwise the GitHub related service would fail.
  • CRON_CONFIG: You could set how many tasks to create each day.

The solutions should be placed in res/solutions/. Each question has a directory named as its number. You could delete all the solutions I created and start writing yours.

Travis-CI Settings

  • Turn on this repository on your Travis-CI.
  • Add an environment variable GITHUB_TOKEN with the value of your GitHub OAuth token.
  • Turn on daily cron jobs for this repository.

Usage

There are some useful utilities that save you from the boring tasks.

Fetch LeetCode Algorithm Problems

Running the following command, then a leetcode-questions.json would be generated in the res folder.

$ python3 core/core.py update_local_questions --js_path=/usr/local/bin/phantomjs

js_path represents the path to PhantomJS. You have to prepare it in advance.

If you are MacOS user, just simply use $ brew install phantomjs to download it.

Create random daily tasks

This would create random tasks as issues in this repository. The number of tasks could be set in core/constant.py.

$ python3 core/core.py create_daily_task --token=$GITHUB_TOKEN

Travis-CI has cron jobs running the command every day. But you could still run it manually to create issues, in case you want some more questions to practice some day. :D

Generate solution pages

This would help you generate the solution pages from the source in res/solutions folder. The generated solutions would be in build folder.

$ python3 core/core.py generate_solutions

With the help of Travis-CI, the solutions would be deployed to GitHub Pages of this repository.

To-Do List

  • LeetCode problems spider
  • Automatic issue creator powered by Travis-CI
  • Solution page generation and deployment
  • Testing the solutions' format.

Author

License

  GNU GENERAL PUBLIC LICENSE
  Version 3, 29 June 2007

  Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.

About

LeetCode practice task generator.

License:GNU General Public License v3.0


Languages

Language:Java 58.0%Language:Python 38.0%Language:C++ 4.0%