Display help message. It also shows examples of the commands.
leetcode help <command> to see help on sub command.leetcode <command> -h also works.Examples
$ leetcode -hleetcode [command]Commands: leetcode cache [keyword] Manage local cache leetcode config [key] [value] Manage user configs [aliases: conf, cfg, setting] leetcode list [keyword] List questions [aliases: ls] leetcode plugin [name] Manage plugins [aliases: extension, ext] leetcode session [keyword] Manage sessions [aliases: branch] leetcode show [keyword] Show question [aliases: view, pick] leetcode star <keyword> Star favorite question [aliases: like, favorite] leetcode stat Show statistics [aliases: stats, progress, report] leetcode submission [keyword] Download submission code [aliases: pull] leetcode submit <filename> Submit code [aliases: push, commit] leetcode test <filename> Test code [aliases: run] leetcode user Manage account [aliases: account] leetcode version Show version info [aliases: info, env] leetcode completion generate bash completion scriptOptions: -h, --help Show help [boolean]Seek more help at https://skygragon.github.io/leetcode-cli/commandsShow help on sub command:
$ leetcode cache -hleetcode cache [keyword]Manage local cachePositionals: keyword Cache name or question id [string] [default: ""]Options: -h, --help Show help [boolean] -d, --delete Delete cache by keyword [boolean] [default: false]Examples: leetcode cache Show all cache leetcode cache 1 Show cache of question 1 leetcode cache -d Delete all cache leetcode cache 1 -d Delete cache of question 1Show local cached questions.
leetcode cache <id> to show specific question cache by id.-d <id> to delete specific question cache by id.-d to delete all cached questions.Examples
Show cache:
$ leetcode cacheproblems 190.71K 7 hours ago1.two-sum.algorithms 2.82K 13 hours ago733.flood-fill.algorithms 4.52K 7 hours ago746.min-cost-climbing-stairs.algorithms 2.96K 8 hours ago......Delete cache of question 733:
$ leetcode cache -d 733Manage user config.
leetcode config to show all user customized configs.-a to show all user configs (includes default ones).leetcode config <key> to show config by key.leetcode config <key> <value> to set config by key.-d to delete config by key.Examples
Set config:
$ leetcode config color:enable falseNOTE: the key is using colon “:” as the separator, not dot “.”
Show config by key:
$ leetcode config color{ "enable": true}Navigate the quations.
✔ means you have AC-ed this question.✘ means not AC-ed.★ means starred question.🔒 means locked question.-q to query by conditions.e = easy,E = not easy = m + h.m = medium,M = not medium = e + h.h = hard,H = not hard = e + m.d = done = AC-ed,D = not AC-ed.l = locked,L = not locked.s = starred,S = unstarred.-t to filter by given tag.algorithmsdatabaseshell-s to show statistic counters of the output list.leetcode list <keyword> to search by keyword matching.Examples
Show statistcis:
$ leetcode list -s [385] Mini Parser Medium (26.5%) ✘ [384] Shuffle an Array Medium (45.7%) ✔ [383] Ransom Note Easy (44.5%) ✔ [382] Linked List Random Node Medium (46.6%) ...... ✔ [ 4] Median of Two Sorted Arrays Hard (19.6%) ✔ [ 3] Longest Substring Without Repeating Characters Medium (22.9%)★ ✔ [ 2] Add Two Numbers Medium (25.37 %)★ ✔ [ 1] Two Sum Easy (27.61 %) Listed: 400 Locked: 73 Starred: 3 Accept: 196 Not-AC: 15 Remain: 189 Easy: 106 Medium: 207 Hard: 87Use keyword search and query:
$ leetcode list -q Dml array 🔒 [360] Sort Transformed Array Medium (41.0%) 🔒 [325] Maximum Size Subarray Sum Equals k Medium (40.9%)Manage plugins. To install 3rd party plugins, please check theAdvanced Tips.
-i to install new plugin.-d to disable plugin.-e to enable plugin.-D to physically delete plugin.-c to show plugin’s config.Example
Install plugin from github:
$ leetcode plugin -i company(Deprecated) Install plugin from local file:
$ leetcode plugin -i <path/of/local/file>/company.jsList all the plugins,✘ means the plugin is disabled.
$ leetcode plugin✔ retry default Plugin to retry last failed request if autologin is on.✔ cache default Plugin to provide local cache.✔ leetcode default Plugin to talk with leetcode APIs.Manage coding sessions, each session has individual status traced.
-c to create new session.-e to enable/activate specific seesion.-d to delete session.Examples
Show all sessions:
$ leetcode sessionActive Id Name AC Questions AC Submits-------------------------------------------------------------------------------- ✔ 77299 Anonymous Session 393 ( 98.50 %) 896 ( 47.13 %) 1111667 Untitled Session 0 ( 0.00 %) 0 ( 0.00 %)Display question details. With-g/-l/-x, the code template would be auto generated for you.
-g to generate source file.-x to add question description in the generated source file.-e to open editor with generated source file.-o to specify the output folder.-l to choose programming language. (Depends on which langs are provided on leetcode)-c to only show code template.leetcode show 1leetcode show "Two Sum"leetcode show two-sumleetcode show-q to filter questions by query. (same aslist command)-t to filter questions by tags. (same aslist command)Examples
$ leetcode show 1 -g -l cpp[1] Two Sum (File: two-sum.cpp)https://leetcode.com/problems/two-sum/* algorithms* Easy (25.6%)* Total Accepted: 274880* Total Submissions: 1074257* Testcase Example: '[3,2,4]\n6'Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given nums = [2, 7, 11, 15], target = 9,Because nums[0] + nums[1] = 2 + 7 = 9,return [0, 1].UPDATE (2016/2/13):The return format had been changed to zero-based indices. Please read the above updated description carefully.Only show the code template:
$ leetcode show -c 1class Solution {public: vector<int> twoSum(vector<int>& nums, int target) { }};Random select question: easy + unlocked
$ leetcode show -q eLMark your favorite questions. The starred question will be shown with a★.
-d to unstar.leetcode star "Two Sum"leetcode star two-sumExample
$ leetcode star 1[1] Two Sum ★$ leetcode star 1 -d[1] Two Sum ☆Show your personal statistics of the question progress.
-g to show the heatmap graph of all the questions.-c to show how many AC-ed questions per day by calendar.-q to filter questions by query. (same aslist command)-t to filter questions by tags. (same aslist command)--no-lock to exclude lokced questions.Example
Show AC-ed progress:
$ leetcode statEasy 141/205 ( 68.78 %) █████████████████████░░░░░░░░░Medium 200/365 ( 54.79 %) █████████████████░░░░░░░░░░░░░Hard 52/148 ( 35.14 %) ███████████░░░░░░░░░░░░░░░░░░░Show heatmap graph:
$ leetcode stat -g 1 10 11 20 21 30 31 40 41 50 000 ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ⬚ ▣ ▣ ▣ ▣ ▣ ▣ ⬚ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ 050 ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ 100 ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ⬚ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ 150 ▣ ▣ ▣ ▣ ▣ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ▣ ⬚ ▣ ▣ ▣ ▣ ▣ ▣ ⬚ ▣ ▣ ▣ ▣ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ▣ ▣ ▣ ▣ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ▣ ▣ ▣ 200 ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ⬚ ▣ ▣ ▣ ▣ ▣ ⬚ ▣ ▤ ▣ ▣ ▣ ⬚ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ 250 ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ▣ ⬚ ▣ ⬚ ⬚ ▣ ▣ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ▣ ⬚ ⬚ ▣ ▣ ⬚ ⬚ ⬚ ▣ ▣ ⬚ ⬚ ▣ ⬚ ⬚ ▣ ⬚ ▣ ⬚ ⬚ ▣ ⬚ ▣ ⬚ ▣ ▣ 300 ▣ ⬚ ▣ ▣ ⬚ ▣ ▣ ⬚ ▣ ⬚ ⬚ ▣ ▣ ⬚ ▣ ▣ ⬚ ▣ ▣ ⬚ ⬚ ▣ ⬚ ▤ ⬚ ▣ ⬚ ▣ ▣ ▣ ▣ ▣ ⬚ ▣ ▣ ▤ ▣ ▣ ⬚ ⬚ ▣ ▣ ▣ ▣ ▣ ⬚ ▣ ⬚ ▣ ▣ 350 ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ▣ ▣ ⬚ ⬚ ▣ ▣ ▣ ▣ ⬚ ⬚ ▣ ⬚ ⬚ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▤ ⬚ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ ▣ 400 ▣ ▣ ▣ ▣ ▣ ▣ ⬚ ⬚ ▣ ⬚ ⬚ ▣ ▣ ▣ ▣ ▣ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ▣ ▣ ⬚ ▣ ▣ ⬚ ⬚ ▣ ▣ ⬚ ⬚ ▣ ⬚ ▣ ▣ ⬚ ⬚ 450 ▣ ▣ ▣ ⬚ ▣ ▣ ▣ ⬚ ▣ ▣ ▣ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ▣ ▣ ▣ ▣ ▣ ⬚ ⬚ ▣ ▣ ⬚ ⬚ ▣ ▣ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ▣ ▣ ▣ ▣ ⬚ ▣ 500 ▣ ⬚ ▣ ▣ ⬚ ▣ ▣ ▣ ▣ ⬚ ▣ ▣ ▤ ▣ ⬚ ⬚ ▣ ▣ ▤ ▣ ⬚ ▣ ▣ ⬚ ▣ ⬚ ▣ ⬚ ▣ ▣ ▣ ⬚ ▣ ▣ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ 550 ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ▣ ⬚ ▣ ⬚ ▣ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ▣ 600 ⬚ ⬚ ⬚ ⬚ ▣ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ▣ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ 650 ⬚ ▣ ▣ ▣ ⬚ ⬚ ▣ ▣ ⬚ ▣ ⬚ ▣ ⬚ ⬚ ▣ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ 700 ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ⬚ ▣ ▣ ⬚ ⬚ ⬚ 750 ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ Accepted ▤ Not Accepted ⬚ RemainingShow calendar graph:
$ leetcode stat -c Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec JanSun ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚Mon ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚Tue ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚Wed ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚Thu ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚Fri ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚Sat ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ⬚ ▣ ▣ 1~5 ▣ 6~10 ▣ 11~15 ▣ 16+Download your former submissions.
Available options:
-o to specify the output folder.-a to work against all questions.-l to filter by specific programming language.-x to add question details in the output file.leetcode submission 1leetcode submission two-sumExamples
$ leetcode submission -a -o tmp[303] Range Sum Query - Immutable tmp/range-sum-query-immutable.52178990.ac.cpp[319] Bulb Switcher tmp/bulb-switcher.52257927.ac.cpp[313] Super Ugly Number tmp/super-ugly-number.52256965.ac.cpp......[ 1] Two Sum tmp/two-sum.73790064.ac.cppSubmit code to leetcode.com.
Examples
$ leetcode submit ./two-sum.cpp ✔ Accepted ✔ 16/16 cases passed (12 ms) ✔ Your runtime beats 49.89 % of cpp submissionsTest code on leetcode.com. If no testcase provided, a default testcase will be used.
-t to provide test case in command line.' to surround your test case. (double quote is NOT safe in bash shell due to escaping)-i to provide test case in interactive mode.Ctrl-D to finish input.Ctrl-D andReturn to finish input.Examples
$ leetcode test ./two-sum.cpp -t '[3,2,4]\n7'Input data:[3,2,4]7Actual ✔ runtime: 0 ms ✘ answer: [1,2] ✔ output:Expected ✔ runtime: 0 ms ✔ answer: [0,2] ✔ output:Login with your leetcode account (username or email).
-l to login-L to logout.leetcode user to show current account.Examples
Login:
$ leetcode user -llogin: <your account>pass:Successfully login as <your account>Display version information.
-v to show verbose info.Examples
Short:
$ leetcode version2.6.2Verbose:
$ leetcode version -v _ _ _| | | | | || | ___ ___| |_ ___ ___ __| | ___| |/ _ \/ _ \ __|/ __|/ _ \ / _` |/ _ \| | __/ __/ |_ (__| (_) | (_| | __/|_|\___|\___|\__|\___|\___/ \__,_|\___| CLI v2.6.2[Environment]Node v8.1.4OS darwin 15.6.0Cache /Users/skygragon/.lc/cacheConfig /Users/skygragon/.lc/config.json[Configuration]autologin {"enable":true}code {"editor":"vim","lang":"cpp"}color {"enable":true,"theme":"molokai"}icon {"theme":""}network {"concurrency":10}[Themes]Colors blue,dark,default,molokai,orange,pink,solarized,solarized.lightIcons ascii,default,win7[Plugins]solution.discuss 2017.12.21company 2017.12.18github 2017.08.10cache defaultretry defaultleetcode default