/leetcode.el

An Emacs LeetCode client.

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

MELPA

Introduction

LeetCode brings you offer, and now Emacs brings you LeetCode!

Usage

screencast

  1. Execute leetcode command, and in problem list buffer:
keymap command
n cursor move down
p cursor move up
s filter problems by regex
t filter problems by tag
d filter problems by difficulty
/ clear filters
g refresh without fetching from LeetCode
G refresh all data
RET show current problem description
  1. Press <RET>, show problem description, move cursor to "solve it", press <RET> again, start coding!

  2. After finishing your code, you can edit testcase and execute leetcode-try or execute leetcode-submit.

leetcode-submit

Installation

LeetCode do not allow third party login, one workaround is restore LeetCode session from local Firefox or Chrome cookies. By default, this package will install a Python3 package called my_cookies, or you can install it manually: pip3 install my_cookies.

Manually

  1. Clone this repository and install all dependencies
  2. Move it to your load-path
  3. Require it in your emacs config

Configuration

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.

You can save solution by setting leetcode-save-solutions:

(setq leetcode-save-solutions t)
(setq leetcode-directory "~/leetcode")

Debug

Call leetcode-toggle-debug, log will output in *leetcode-log* buffer.

Contributing

Please submit PR to develop branch.