Movatterモバイル変換


[0]ホーム

URL:


leetcode-cli

A cli tool to enjoy leetcode!

View on GitHub

help

Display help message. It also shows examples of the commands.

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/commands

Show 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 1

cache

Show local 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 733

config

Manage user config.

Examples

Set config:

$ leetcode config color:enable false

NOTE: the key is using colon “:” as the separator, not dot “.”

Show config by key:

$ leetcode config color{    "enable": true}

list

Navigate the quations.

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:    87

Use 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%)

plugin

Manage plugins. To install 3rd party plugins, please check theAdvanced Tips.

Example

Install plugin from github:

$ leetcode plugin -i company

(Deprecated) Install plugin from local file:

$ leetcode plugin -i <path/of/local/file>/company.js

List 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.

session

Manage coding sessions, each session has individual status traced.

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 %)

show

Display question details. With-g/-l/-x, the code template would be auto generated for you.

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 eL

star

Mark your favorite questions. The starred question will be shown with a.

Example

$ leetcode star 1[1] Two Sum ★$ leetcode star 1 -d[1] Two Sum ☆

stat

Show your personal statistics of the question progress.

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   ⬚  Remaining

Show 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+

submission

Download your former submissions.

Available options:

Examples

$ 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.cpp

submit

Submit code to leetcode.com.

Examples

$ leetcode submit ./two-sum.cpp  ✔ Accepted  ✔ 16/16 cases passed (12 ms)  ✔ Your runtime beats 49.89 % of cpp submissions

test

Test code on leetcode.com. If no testcase provided, a default testcase will be used.

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:

user

Login with your leetcode account (username or email).

Examples

Login:

$ leetcode user -llogin: <your account>pass:Successfully login as <your account>

version

Display version information.

Examples

Short:

$ leetcode version2.6.2

Verbose:

$ 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

[8]ページ先頭

©2009-2025 Movatter.jp