refactor: remove Java code sections from all LeetCode Hot 100 markdown files

- Remove all "## Java 解法" sections and Java code blocks
- Replace "## Go 解法" with "## 解法"
- Remove "### Go 代码要点" and "### Java 代码要点" sections
- Keep all Go code sections intact
- Maintain complete documentation structure and content
- Update 22 markdown files in the LeetCode Hot 100 directory
This commit is contained in:
2026-03-05 12:31:48 +08:00
parent 184f388a45
commit 15dbd75004
9 changed files with 164 additions and 894 deletions

View File

@@ -125,65 +125,6 @@ func main() {
### Java 实现
```java
public class ContainerWithMostWater {
public int maxArea(int[] height) {
int left = 0;
int right = height.length - 1;
int maxArea = 0;
while (left < right) {
// 计算当前面积
int width = right - left;
int h = Math.min(height[left], height[right]);
int area = width * h;
// 更新最大面积
maxArea = Math.max(maxArea, area);
// 移动较短的指针
if (height[left] < height[right]) {
left++;
} else {
right--;
}
}
return maxArea;
}
// 测试用例
public static void main(String[] args) {
ContainerWithMostWater solution = new ContainerWithMostWater();
// 测试用例1
int[] height1 = {1, 8, 6, 2, 5, 4, 8, 3, 7};
System.out.println("输入: [1, 8, 6, 2, 5, 4, 8, 3, 7]");
System.out.println("输出: " + solution.maxArea(height1)); // 期望输出: 49
// 测试用例2
int[] height2 = {1, 1};
System.out.println("\n输入: [1, 1]");
System.out.println("输出: " + solution.maxArea(height2)); // 期望输出: 1
// 测试用例3: 递增序列
int[] height3 = {1, 2, 3, 4, 5};
System.out.println("\n输入: [1, 2, 3, 4, 5]");
System.out.println("输出: " + solution.maxArea(height3)); // 期望输出: 6
// 测试用例4: 递减序列
int[] height4 = {5, 4, 3, 2, 1};
System.out.println("\n输入: [5, 4, 3, 2, 1]");
System.out.println("输出: " + solution.maxArea(height4)); // 期望输出: 6
// 测试用例5: 包含0
int[] height5 = {0, 2};
System.out.println("\n输入: [0, 2]");
System.out.println("输出: " + solution.maxArea(height5)); // 期望输出: 0
}
}
```
## 复杂度分析