# LeetCode **Repository Path**: bee19940901/leet-code ## Basic Information - **Project Name**: LeetCode - **Description**: Bee的力扣算法刷题笔记(C++) - **Primary Language**: C++ - **License**: MIT - **Default Branch**: master - **Homepage**: https://leetcode.cn/u/bee0901 - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-15 - **Last Updated**: 2026-04-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README
# | C++ Solutions ### 一个系统化的 LeetCode 刷题仓库,收录 600+ 道经典算法题解 [![C++23](https://img.shields.io/badge/C++-23-blue.svg)](https://en.cppreference.com/w/cpp/23) [![CMake](https://img.shields.io/badge/CMake-3.10+-blue.svg)](https://cmake.org/) [![License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![Gitee](https://img.shields.io/badge/Gitee-Repository-red.svg)](https://gitee.com/bee19940901/leet-code)
--- ## 本项目是一个精心整理的 LeetCode 题解仓库,采用 **C++23** 标准编写,旨在为算法学习与面试准备提供高质量的参考实现。 ### - **系统化组织** | 题解按编号分目录存放,结构清晰,便于查找 - **现代 C++** | 使用 C++23 特性,代码简洁高效 - **完整测试** | 配套 Google Test 单元测试,验证解法正确性 - **规范编码** | 统一的代码风格与注释格式 --- ## | 指标 | 数值 | |------|------| | 题目数量 | 600+ | | 代码文件 | 606 个 | | 代码行数 | 52,000+ | | 测试用例 | 40+ | ### ``` solution 1-100 | 21 道题 solution 101-200 | 27 道题 solution 201-300 | 24 道题 solution 301-400 | 15 道题 solution 401-500 | 18 道题 solution 501-600 | 18 道题 solution 601-700 | 15 道题 solution 701-800 | 9 道题 solution 801-900 | 10 道题 solution 901-1000 | 11 道题 solution 1001-1100 | 12 道题 solution 1101-1200 | 6 道题 solution 1201-1300 | 7 道题 solution 1301-1400 | 19 道题 solution 1401-1500 | 17 道题 solution 1501-1600 | 17 道题 solution 1601-1700 | 17 道题 solution 1701-1800 | 19 道题 solution 1801-1900 | 16 道题 solution 1901-2000 | 17 道题 solution 2001-2100 | 17 道题 solution 2101-2200 | 21 道题 solution 2201-2300 | 16 道题 solution 2301-2400 | 14 道题 solution 2401-2500 | 15 道题 solution 2501-2600 | 16 道题 solution 2601-2700 | 12 道题 solution 2701-2800 | 12 道题 solution 2801-2900 | 16 道题 solution 2901-3000 | 13 道题 solution 3001-3100 | 14 道题 solution 3101-3200 | 11 道题 solution 3201-3300 | 15 道题 lc 3301-3800 | 30+ 道题 面试精选 | N 道 LCP 专项 | 8 道 LCR 专项 | 25+ 道 CIQ 专项 | 10+ 道 ``` --- ## ``` leet-code/ ├── include/ │ ├── solution1-100/ # 1-100 题 │ ├── solution101-200/ # 101-200 题 │ ├── solution201-300/ # 201-300 题 │ ├── solution301-400/ # 301-400 题 │ ├── solution401-500/ # 401-500 题 │ ├── solution501-600/ # 501-600 题 │ ├── solution601-700/ # 601-700 题 │ ├── solution701-800/ # 701-800 题 │ ├── solution801-900/ # 801-900 题 │ ├── solution901-1000/ # 901-1000 题 │ ├── solution1001-1100/ # 1001-1100 题 │ ├── solution1101-1200/ # 1101-1200 题 │ ├── solution1201-1300/ # 1201-1300 题 │ ├── solution1301-1400/ # 1301-1400 题 │ ├── solution1401-1500/ # 1401-1500 题 │ ├── solution1501-1600/ # 1501-1600 题 │ ├── solution1601-1700/ # 1601-1700 题 │ ├── solution1701-1800/ # 1701-1800 题 │ ├── solution1801-1900/ # 1801-1900 题 │ ├── solution1901-2000/ # 1901-2000 题 │ ├── solution2001-2100/ # 2001-2100 题 │ ├── solution2101-2200/ # 2101-2200 题 │ ├── solution2201-2300/ # 2201-2300 题 │ ├── solution2301-2400/ # 2301-2400 题 │ ├── solution2401-2500/ # 2401-2500 题 │ ├── solution2501-2600/ # 2501-2600 题 │ ├── solution2601-2700/ # 2601-2700 题 │ ├── solution2701-2800/ # 2701-2800 题 │ ├── solution2801-2900/ # 2801-2900 题 │ ├── solution2901-3000/ # 2901-3000 题 │ ├── solution3001-3100/ # 3001-3100 题 │ ├── solution3101-3200/ # 3101-3200 题 │ ├── solution3201-3300/ # 3201-3300 题 │ ├── lc3301-3400/ # 3301-3400 题 │ ├── lc3401-3500/ # 3401-3500 题 │ ├── lc3501-3600/ # 3501-3600 题 │ ├── lc3601-3700/ # 3601-3700 题 │ ├── lc3701-3800/ # 3701-3800 题 │ ├── code3801-3900/ # 3801-3900 题 │ ├── interview/ # 面试题 │ ├── lcp/ # LCP 专项 │ ├── lcr/ # LCR 专项 │ └── ciq/ # CIQ 专项 ├── src/ │ └── main.cpp # 程序入口 ├── tests/ │ ├── test14.cpp # 单元测试 │ ├── test70.cpp │ ├── ... │ └── test3750.cpp ├── CMakeLists.txt # CMake 配置 └── README.md # 项目文档 ``` --- ## | 技术 | 版本 | |------|------| | C++ | C++23 | | CMake | 3.10+ | | Google Test | 1.15.2 | --- ## ### ```bash # 克隆仓库 git clone https://gitee.com/bee19940901/leet-code.git cd leet-code ``` ### ```bash # 创建构建目录 mkdir build && cd build # 配置 CMake cmake .. # 编译 cmake --build . ``` ### ```bash # 运行主程序 ./leet_code # 运行测试 ./runTests ``` --- ## ### 题解示例 ```cpp // solution14.hpp - 最长公共前缀 #ifndef LEET_CODE_SOLUTION14_HPP #define LEET_CODE_SOLUTION14_HPP #include #include #include using namespace std; string longestCommonPrefix(vector& strs) { string str = strs[0]; for(int i = 1; i < strs.size(); ++i){ if(strs[i].size() < str.size()){ str = strs[i]; } } if(str.empty()) return ""; for(int j = 0; j < str.size(); ++j){ for (int a = 0; a < strs.size(); ++a) { if (strs[a][j] != str[j]){ return str.substr(0, j); } } } return str; } #endif ``` ### 测试示例 ```cpp // test14.cpp #include #include "solution1-100/solution14.hpp" TEST(Test14, t1){ vector inp = {"flower","flow","flight"}; string exp = "fl"; auto res = longestCommonPrefix(inp); EXPECT_EQ(exp, res); } TEST(Test14, t2){ vector inp = {"dog","racecar","car"}; string exp = ""; auto res = longestCommonPrefix(inp); EXPECT_EQ(exp, res); } ``` --- ## 欢迎提交 Issue 和 Pull Request! ### 1. 新增题解请按编号存放在对应目录 2. 代码风格保持与现有代码一致 3. 为新增题解编写对应的单元测试 4. 提交前请确保测试通过 --- ## - [ ] 补全所有缺失的题解 - [ ] 添加复杂度分析注释 - [ ] 提供多种解法对比 - [ ] 添加解题思路文档 --- ## 本项目采用 [MIT](LICENSE) 许可证。 ---
**Made with** ♥ **by** @bee19940901