{"id":23545378,"url":"https://github.com/ncdhz/leetcode","last_synced_at":"2025-08-30T10:39:37.953Z","repository":{"id":173714918,"uuid":"528956692","full_name":"ncdhz/leetcode","owner":"ncdhz","description":"save leetcode code","archived":false,"fork":false,"pushed_at":"2024-05-29T12:32:31.000Z","size":2035,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-24T03:13:06.772Z","etag":null,"topics":["algorithem","ant-design-vue","leetcode","vue3-typescript"],"latest_commit_sha":null,"homepage":"https://ncdhz.github.io/leetcode/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ncdhz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-25T17:41:25.000Z","updated_at":"2024-08-19T05:43:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2f42e8b-ac0f-49aa-958d-5fdf17c0a59c","html_url":"https://github.com/ncdhz/leetcode","commit_stats":null,"previous_names":["ncdhz/leetcode"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ncdhz/leetcode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncdhz%2Fleetcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncdhz%2Fleetcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncdhz%2Fleetcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncdhz%2Fleetcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ncdhz","download_url":"https://codeload.github.com/ncdhz/leetcode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ncdhz%2Fleetcode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272839651,"owners_count":25001861,"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","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["algorithem","ant-design-vue","leetcode","vue3-typescript"],"created_at":"2024-12-26T08:16:57.082Z","updated_at":"2025-08-30T10:39:37.856Z","avatar_url":"https://github.com/ncdhz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 介绍\n\n辛辛苦苦刷的`LeetCode`代码不展示出来，岂不对不起每天熬的夜和掉的头发。所以他来了，3分钟搭建属于自己的`LeetCode`代码展示平台。\n\n# 效果\n\n点击 [https://ncdhz.github.io/leetcode/](https://ncdhz.github.io/leetcode/)即可查看效果.\n\n1. 电脑版本效果，`Python`和`JavaScript`等菜单表示使用什么语言完成的算法，其中`Home`表示所有语言。`Title No:1-50`表示编号为`1-50`的算法，`Number:1-10` 表示编号细分`1-10`的算法。搜索栏可以通过算法编号或者算法名字搜索对应的算法。\n\n\u003cimg src=\"./docs/images/computer.png\" width=\"60%\"/\u003e\n\n\n2. 手机版本效果，左图是手机端的页面，右图是手机端的菜单。\n\n\u003cimg src=\"./docs/images/phone.png\" width=\"30%\"/\u003e\u003cimg src=\"./docs/images/phone_menu.png\" width=\"30%\"/\u003e\n\n\n# 搭建\n\n通过下面操作可以在自己的`Github`平台搭建出和上面一样的`LeetCode`展示平台。\n\n1. 在`Visual Studio Code`中安装插件用来编写`LeetCode`算法，可以参考文章[VSCode 中安装LeetCode插件](https://zhuanlan.zhihu.com/p/561622236)。\n2. 在自己的`Github`中`Fork` 项目[https://github.com/ncdhz/leetcode](https://github.com/ncdhz/leetcode)，或者下载此项目到本地配置完成后上传到自己的`Github`。\n\n```shell\n# 克隆项目到本地\n\u003e\u003e git clone https://github.com/ncdhz/leetcode.git\n```\n\n3. 根据需要删除不需要的文件或文件夹。\n\n```shell\n# 此文件夹存放的是算法源文件，可以先不删除等搭建成功后换成自己的算法源文件就好。\n\u003e\u003e rm -rf code\n# 此文件夹是由vite打包生成的JavaScript、css、html和静态资源文件\n\u003e\u003e rm -rf docs\n# 此项目介绍文件\n\u003e\u003e rm README.md\n```\n\n4. 配置`Node`环境，移步`Node`[官网](https://nodejs.org/en/)。\n5. 安装项目依赖。\n\n``` bash\n# 有make环境\n\u003e\u003e make install\n# 没有make环境\n\u003e\u003e cd web\n\u003e\u003e npm install\n```\n\n6. 生成数据集，如下图算法文件名格式`number.name.[js/py...]`，`number`表示算法编号，`name`表示算法名称，最后是语言后缀。\n\n\u003e 不用担心新建文件麻烦，可以直接把`VSCode`中`LeetCode`插件的保存目录配置到`code`目录即可，[VSCode——设置代码存储目录](https://zhuanlan.zhihu.com/p/561622236)。\n\n![code file name](./docs/images/code_file_name.png)\n\n```bash\n# 如果你保存算法目录是 code\n# 有make环境\n\u003e\u003e make code2db\n# 没有make环境\n\u003e\u003e node web/code2db.js code\n# 如果你保存算法目录不是 code\n\u003e\u003e node web/code2db.js 目录\n```\n\n7. 测试, 结果如下图，只需要在本地浏览器中访问 [http://localhost:5173/](http://localhost:5173/) 就可以浏览`LeetCode 展示平台了`。\n   \n![vite dev](./docs/images/vite_dev.png)\n\n``` bash\n# 有make环境\n\u003e\u003e make dev\n# 没有make环境\n\u003e\u003e cd web\n\u003e\u003e npm run dev\n```\n\n8. 配置，配置文件在`web/src/config.ts`里，你可以更改里面的内容。\n\n``` js\n{\n  // Github地址\n  github: \"https://github.com/ncdhz/leetcode/\",\n  // 你所使用的语言后缀，对应的语言名字。\n  codeMessage: {\n    // 语言后缀\n    java: {\n      // 语言名称\n      name: \"Java\",\n    },\n    ...\n  },\n  // 每页显示数量\n  itemSpace: 10,\n  // 多少个小菜单组成一个大菜单\n  menuSpace: 5,\n  // logo 在public文件夹里面，你可以替换成自己的\n  authorImg: \"./logo.png\",\n  // 算法开始标志\n  startFlag: \"code=start\",\n  // 算法结束标志\n  endFlag: \"code=end\"\n}\n```\n\n9. 打包并上传到 `Github`，打包前可以删除 `docs` 文件夹。\n\n\u003e 打包之前别忘了更新数据 `make code2db`\n\n``` bash\n# 有make环境\n\u003e\u003e make build\n# 没有make环境\n\u003e\u003e cd web \n\u003e\u003e npm run build\n\n# 上传到Github\n# 通过命令行 [如果你是Fork并clone你Fork的项目可以进行如下操作]\n\u003e\u003e git add .\n\u003e\u003e git commit -m \"init\"\n\u003e\u003e git push -u origin main\n```\n\n10. `Github Pages`，上传到`Github`之后，需要配置`Github Pages`就能通过域名访问了。第一步打开`Github`中当前项目点击`Setting`，第二步点击`Pages`，第三步更改为`docs`目录并保存。等待几分钟就可以访问你的`LeetCode`展示平台了。网址[https://用户名.github.io/项目名](https://ncdhz.github.io/leetcode/)。\n    \n![Github Pages](./docs/images/github_pages.png)\n\n# 总结\n\n此项目为`LeetCode 展示平台`，如果你有更好的想法可以提提意见说不定我就按照你的想法修改了呢。\n\n\u003e 一个工作都没有找到的同志花时间开发这个玩意——爱好，开发不易，多多Star，多多Fork。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncdhz%2Fleetcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fncdhz%2Fleetcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fncdhz%2Fleetcode/lists"}