{"id":18662639,"url":"https://github.com/zcong1993/leetcode-tool","last_synced_at":"2025-04-11T21:31:52.862Z","repository":{"id":44919132,"uuid":"313278625","full_name":"zcong1993/leetcode-tool","owner":"zcong1993","description":"一个让你更方便刷题的工具","archived":false,"fork":false,"pushed_at":"2022-01-18T15:59:22.000Z","size":40,"stargazers_count":16,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T08:15:47.857Z","etag":null,"topics":["leetcode","leetcode-tool"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zcong1993.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-16T11:21:32.000Z","updated_at":"2024-08-29T02:27:23.000Z","dependencies_parsed_at":"2022-09-10T17:01:53.955Z","dependency_job_id":null,"html_url":"https://github.com/zcong1993/leetcode-tool","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcong1993%2Fleetcode-tool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcong1993%2Fleetcode-tool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcong1993%2Fleetcode-tool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zcong1993%2Fleetcode-tool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zcong1993","download_url":"https://codeload.github.com/zcong1993/leetcode-tool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248483012,"owners_count":21111418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["leetcode","leetcode-tool"],"created_at":"2024-11-07T08:13:19.354Z","updated_at":"2025-04-11T21:31:52.610Z","avatar_url":"https://github.com/zcong1993.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# leetcode-tool ![goreleaser](https://github.com/zcong1993/leetcode-tool/workflows/goreleaser/badge.svg)\n\n\u003c!--\n[![Go Report Card](https://goreportcard.com/badge/github.com/zcong1993/leetcode-tool)](https://goreportcard.com/report/github.com/zcong1993/leetcode-tool)\n--\u003e\n\n\u003e 一个让你更方便刷题的工具\n\n## Install\n\n```bash\n# homebrew\n$ brew tap zcong1993/homebrew-tap\n$ brew install zcong1993/homebrew-tap/leetcode-tool\n\n# 直接安装\ncurl -fsSL https://bina.egoist.sh/zcong1993/leetcode-tool | sh\n\n# show help\n$ leetcode-tool help\n```\n\n## 配置\n\n可以在项目根目录创建 `.leetcode.json` 配置文件.\n\n```js\n{\n  \"lang\": \"go\", // 项目全局语言, 配置后 new 命令 --lang 参数可省略, 目前支持 go ts js py3 java\n  \"cookie\": \"xxx\"\n}\n```\n\n## 使用说明\n\n[https://blog.cong.moe/post/2020-11-30-leetcode_tool](https://blog.cong.moe/post/2020-11-30-leetcode_tool)\n\n## 支持语言\n\n- Golang go\n- Typescript ts\n- Javascript js\n- Python3 py3\n- Java java\n\n## 主要功能\n\n### 新建题目代码\n\n`leetcode-tool new [\u003cflags\u003e] \u003cnumber\u003e`\n\nnumber 为网页上显示的题目序号, 例如: `leetcode-tool new 1` 创建第一题的代码.\n\n此命令会创建一个文件夹和三个文件, 分别是: 代码文件, 测试文件, 题目描述文件.\n\n题目信息从 leetcode 拉取, 并生成一些元信息供更新命令分类更新题目完成状态.\n\n### 查看题目信息\n\n`leetcode-tool meta \u003cnumber\u003e`\n\n展示某道题目一些信息.\n\n### 更新题目状态\n\n`leetcode-tool update`\n\n根据已完成题目类别更新 `toc` 文件夹下的算法分类状态.\n\n### 更新 leetcode 分类\n\n`leetcode-tool tags`\n\n从 leetcode 网站拉取最新分类, 并创建 `toc` 对应文件, 一般不需要运行.\n\n### 重置项目\n\n假如想要重新从零开始, 或者你的项目是基于别人项目 fork 的, 可以使用如下方式清理已有题解:\n\n```shell\n# 1. 删除所有题解文件\nrm -rf solve/*\n# 2. 重新构建 toc 文件, -f 参数会强制覆盖\nleetcode-tool tags -f\n# 2.1 假如你还保留了部分题解, 还需要更新下题目状态\nleetcode-tool update\n```\n\n## Workflow\n\n如何刷题?\n\n```bash\n# 1. 新建一个题目\n$ leetcode-tool new 1\n# 2. 写出题解, 和测试代码\n...\n# 3. 更新 toc 文件\n$ leetcode-tool update\n# 4. 提交代码\n```\n\n## 为什么需要这个工具\n\n1. leetcode 网页 IDE 太弱了, 我需要本地解题\n1. 网页题解难以沉淀, 例如一道题我希望整理多种解法\n1. GitHub 易于分享题解\n1. 根据自己需要, 组织题目做专题之类的总结\n\n## 模板项目\n\n- Typescript [zcong1993/leetcode-ts-template](https://github.com/zcong1993/leetcode-ts-template)\n\n## 使用此工具的项目\n\n- [zcong1993/algo-go](https://github.com/zcong1993/algo-go)\n\n## 常见问题\n\n### 1. 报错 panic: runtime error: invalid memory address or nil pointer dereference\n\n因为 LeetCode 网站现在某些请求会校验 cookie, 采取的修复方法是请求增加了 cookie, 但是内置 cookie 没法确保长期有效.\n\n所以 `.leetcode.json` 配置文件中支持 cookie 配置, 后续请访问此链接 [https://leetcode-cn.com/api/problems/all](https://leetcode-cn.com/api/problems/all) 拿到 cookie 自行更新配置文件.\n\n## License\n\nMIT \u0026copy; zcong1993\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzcong1993%2Fleetcode-tool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzcong1993%2Fleetcode-tool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzcong1993%2Fleetcode-tool/lists"}