leetcode-cli
Features
- the edit flow —— solution files will generate automatically!
- support python script to filter questions
- doc support,
lc-rs
can compile the annotation of your solutions to markdown! - support local signal to keep coding as longer as you want.
Building
Login
Please make sure you have logined in leetcode.com with chrome, the cookie plugin of leetcode-cil can work on both OSX and Linux, username and password are not required, and if you are on other platforms or your cookies just don't want to be catched, please checkout this.
Usage
Please make sure you have logined in leetcode.com
with chrome
, more info plz checkout this
Example
For example, if your config is:
[]
= "rust"
= "emacs"
1. pick
2. edit
3. test
4. submit
Success
Runtime: 0 ms, faster than 100% of Rustonline submissions for Two Sum.
Memory Usage: 2.4 MB, less than 100% of Rustonline submissions for Two Sum.
Cookies
The cookie plugin of leetcode-cil can work on OSX and Linux, If you are on other platforms or your cookies just don't want to be catched, you can handwrite your LeetCode Cookies to ~/.leetcode/leetcode.toml
# Make sure `leetcode.toml` file is placed at `~/.leetcode/leetcode.toml`
[]
= "..."
= "..."
For Example, if you're using chrome to login to leetcode.com.
Step 1
Open chrome and paste the link below to the chrome linkbar
.
chrome://settings/cookies/detail?site=leetcode.com
Step 2
Copy the contents of LEETCODE_SESSION
and csrftoken
.
Step 3
Paste them to session
and csrf
.
# Make sure `leetcode.toml` file is placed at `~/.leetcode/leetcode.toml`
[]
= "${csrftoken}"
= "${LEETCODE_SESSION}"
Programmable
If we want to filter leetcode questions using our own python scripts, what should we do?
For example, our config is:
# Make sure `leetcode.toml` file is placed at `~/.leetcode/leetcode.toml`
[]
= "scripts"
We write our python scripts:
# ~/.leetcode/scripts/plan1.py
;
##
# `print` in python is supported,
# if you want to know the data structures of these two args,
# just print them
##
=
=
=
=
= ;
# return is `List[string]`
return
Then we can run filter as what we write now:
Well done, enjoy it!
PR
PR is welcome, here it is.
LICENSE
MIT