一 、安装lc及依赖
brew install node
nmp install -g leetcode-cli
二、配置及使用
配置lc
$ cat > ~/.lcconfig
{
"LANG": "java",
"USE_COLOR": true,
"COLOR_THEME": "orange",
"AUTO_LOGIN": true,
"PLUGINS": {}
}
这里我使用java 设置自动登录,插件暂时没有安装
➜ leetcode-cli leetcode version -v
_ _ _
| | | | | |
| | ___ ___| |_ ___ ___ __| | ___
| |/ _ \/ _ \ __|/ __|/ _ \ / _` |/ _ \
| | __/ __/ |_ (__| (_) | (_| | __/
|_|\___|\___|\__|\___|\___/ \__,_|\___| CLI v2.0.3
[Environment]
Node v8.9.0
OS darwin 16.7.0
Cache /Users/oldwhite/.lc
Config /Users/oldwhite/.lcconfig
[Configuration]
AUTO_LOGIN true
COLOR_THEME orange
ICON_THEME
LANG java
MAX_WORKERS 10
USE_COLOR true
[Themes]
Colors blue,dark,default,orange,pink
Icons ascii,default,win7
[Plugins]
retry default
cache default
leetcode default
这里显示corlor 为 orange 但是并没有生效,包括默认的default也没有生效,vim打开字符都是白色
show查询lc题目 -g 保存为本地文件
➜ leetcode-cli leetcode show 535 -g -x -l cpp
[535] Encode and Decode TinyURL
https://leetcode.com/problems/encode-and-decode-tinyurl
* algorithms
* Medium (73.98%)
* Source Code: 535.encode-and-decode-tinyurl.cpp
* Total Accepted: 23.2K
* Total Submissions: 31.4K
* Testcase Example: '"https://leetcode.com/problems/design-tinyurl"'
Note: This is a companion problem to the System Design problem: Design TinyURL.
TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http://tinyurl.com/4e9iAk.
Design the encode and decode methods for the TinyURL service. There is no restriction on how your encode/decode algorithm should work. You just need to ensure that a URL can be encoded to a tiny URL and the tiny URL can be decoded to the original URL.
➜ leetcode-cli ls
535.encode-and-decode-tinyurl.cpp 535.encode-and-decode-tinyurl.java