leetcode-cli的安装与使用以及未解决的问题

本文介绍了如何安装和配置 leetcode-cli,包括使用 `brew` 安装 Node 和全局安装 leetcode-cli。在配置过程中遇到了颜色设置不生效的问题。此外,展示了使用 leetcode-cli 的 `show` 命令将题目保存为本地 C++ 文件,并列出一个关于 TinyURL 设计的编程题目。目前遇到的问题是颜色配置未按预期工作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一 、安装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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值