# notes **Repository Path**: StringLuo/notes ## Basic Information - **Project Name**: notes - **Description**: 个人编程学习笔记 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-09 - **Last Updated**: 2025-12-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Notes 项目说明文档 ## 项目简介 该项目是一个包含多个模块的综合代码仓库,主要分为以下两个部分: 1. **Golang 模块**:位于 `Golang/test01.go`,演示了 Go 语言中面向对象编程的基本结构,包括结构体、接口、方法和构造函数的使用。 2. **LeetCode100 模块**:包含多个 LeetCode 常见算法题的实现,每个文件对应一个特定的算法问题,涵盖了数组、链表、字符串、滑动窗口、动态规划等多种数据结构与算法。 该项目适用于学习 Go 语言基础语法、练习 LeetCode 算法题以及理解常见数据结构与算法的实现方式。 --- ## 目录结构 ``` . ├── Golang/ # Golang 示例代码 │ └── test01.go # 用户结构体与接口实现 ├── LeetCode100/ # LeetCode 算法题实现 │ ├── test01.go # TwoSum 系列 │ ├── test02.go # GroupAnagrams 系列 │ ├── test03.go # LongestConsecutive 系列 │ └── ... # 其他 LeetCode 题目实现 ├── main.go # 主程序入口 ├── go.mod # Go 模块配置文件 └── README.md # 项目说明文档 ``` --- ## 安装与运行 ### 环境要求 - Go 1.16 或更高版本 ### 安装步骤 1. 安装 Go 环境:[Go 官网](https://golang.org/dl/) 2. 克隆项目: ```bash git clone https://gitee.com/StringLuo/notes.git ``` 3. 进入项目目录: ```bash cd notes ``` ### 运行项目 运行主程序: ```bash go run main.go ``` --- ## 功能说明 ### Golang 模块 - 定义了一个 `User` 结构体,包含 `age` 字段和常量 `Name`。 - 使用接口 `userRepo` 抽象用户操作,实现 `GetUser` 和 `IsUser` 方法。 - 提供工厂函数 `NewUserRepo` 创建接口实例。 ### LeetCode100 模块 每个文件对应一个 LeetCode 题目,包含多种解法。例如: - `test01.go`:TwoSum 的三种实现方式 - `test02.go`:GroupAnagrams 的多种解法 - `test03.go`:LongestConsecutive 的实现 - ……(其余文件结构类似) 每个测试结构体都实现了 `Test()` 方法用于验证算法的正确性。 --- ## 使用示例 ### 运行主程序 主程序提供 Golang 示例和 LeetCode 测试的调用入口: ```go func main() { t := NewTest() t.golangTest() // 运行 Golang 示例 t.leetCodeTest() // 运行 LeetCode 测试 } ``` ### 自定义测试 你可以修改 `main.go` 或直接运行某个 LeetCode 测试文件,例如: ```bash go run LeetCode100/test01.go ``` --- ## 贡献指南 欢迎提交 Pull Request 来改进本项目。你可以: - 添加新的 LeetCode 题解 - 优化现有算法实现 - 补充测试用例 - 改进文档 提交前请确保代码风格与项目一致,并通过测试验证。 --- ## 许可证 本项目采用 [MIT License](https://opensource.org/licenses/MIT),详情请查看 LICENSE 文件。