# leetcode-java **Repository Path**: codezealotcc/leetcode-java ## Basic Information - **Project Name**: leetcode-java - **Description**: leetcode学习 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-20 - **Last Updated**: 2025-12-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 该项目旨在提供常见算法问题的Java实现,涵盖数据结构操作、字符串处理、数学计算等多个方面。每个类通常对应一个特定的问题或一组相关问题,包含解决问题的方法和测试用例。 ## 安装与运行 确保已安装Java开发环境(JDK 8或更高版本)和Maven。 1. 克隆仓库: ```bash git clone https://gitee.com/codezealotcc/leetcode-java.git ``` 2. 进入项目目录并构建: ```bash cd leetcode-java mvn clean install ``` 3. 运行具体类的`main`方法进行测试: ```bash mvn exec:java -Dexec.mainClass="Solution1" ``` ## 示例:运行两数之和解决方案 `Solution1.java`类中包含解决两数之和问题的两种方法。 ```java public class Solution1 { public int[] twoSum(int[] nums, int target) { // 实现代码 } public int[] twoSum2(int[] nums, int target) { // 另一种实现方式 } public static void main(String[] args) { Solution1 solution = new Solution1(); int[] result = solution.twoSum(new int[]{2, 7, 11, 15}, 9); System.out.println(Arrays.toString(result)); // 输出 [0, 1] } } ``` ## 贡献指南 欢迎提交Pull Request来添加新的解决方案或优化现有实现。请确保: 1. 代码格式化符合标准。 2. 包含适当的注释。 3. 提供测试用例验证新功能。 ## 许可证 本项目采用MIT许可证。详情请查看仓库中的`LICENSE`文件。