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
Installing
error[E0554]
If this happens when compiling the program, it means that the package cannot be compiled with stable Rust. To fix this, install Rust Nightly and try the following:
Usage
Make sure you have logged in to leetcode.com
with Chrome
. See Cookies for why you need to do this first.
)
Example
For example, given this config (can be found in ~/.leetcode/leetcode.toml
):
[]
= "rust"
= "emacs"
1. pick
2. edit
# ;
3. test
4. submit
Cookies
The cookie plugin of leetcode-cli can work on OSX and Linux. If you are on a different platform, there are problems with caching the cookies, you can manually input your LeetCode Cookies to the configuration file.
[]
= "..."
= "..."
For Example, using Chrome (after logging in to LeetCode):
Step 1
Open Chrome and navigate to the link below:
chrome://settings/cookies/detail?site=leetcode.com
Step 2
Copy Content
from LEETCODE_SESSION
and csrftoken
to session
and csrf
in your configuration file, respectively:
[]
= "${csrftoken}"
= "${LEETCODE_SESSION}"
Programmable
If you want to filter LeetCode questions using custom Python scripts, add the following to your the configuration file:
[]
= "scripts"
Then write the script:
# ~/.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 run list
with the filter that you just wrote:
And that's it! Enjoy!
PR
PRs are more than welcome!
LICENSE
MIT