LeetCode brings you offer, and now Emacs brings you LeetCode!
You can package-install
it from melpa directly.
- Clone this repository and install all dependencies
- Move it to your load-path
- Require it in your emacs config
If you use spacemacs, there is a leetcode-emacs-layer. Thanks for Anmol Jagetia!
You can set your preferred LeetCode programming language and SQL by setting leetcode-prefer-language
and leetcode-prefer-sql
:
(setq leetcode-prefer-language "python3")
(setq leetcode-prefer-sql "mysql")
All supported languages can be found in variable leetcode--prefer-language-suffixes
.
- Execute
leetcode
command, then Emacs will prompt you to input account and password. If login successful, Emacs will save it into a file. If you are interested in what happend here, you can check auth-source.el.
In leetcode problems list buffer:
keymap | command |
---|---|
n | cursor move down |
p | cursor move up |
s | filter problem by regex |
t | filter problem by tag |
/ | clear filters |
g | refresh without fetching from LeetCode |
G | refresh all data |
RET | show current problem description |
-
Press
<RET>
, show problem description, move cursor to "solve it", press<RET>
again, start coding! -
After finishing your code, you can edit testcase and execute
leetcode-try
or executeleetcode-submit
.
If you are unable to start Leetcode, set these variables and try again to see a full stacktrace:
(setq url-debug t)
This package use Cask to develop, build and test.
It is a suggestion for you to use Cask
, but if you don't want to bother to use it, it's totally fine too.
Cask
is a build tools for emacs lisp, you can think it of npm
for emacs lisp.
Enter project root, execute cask install
, this command will install all dependencies. After that, execute cask emacs
which will start a emacs with extra load-path
to load dependencies.