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

@@ -81,40 +81,8 @@ func lengthOfLongestSubstring(s string) int {
---
## Java 解法
## 解法
```java
class Solution {
public int lengthOfLongestSubstring(String s) {
// 记录字符最后出现的位置
Map<Character, Integer> charIndex = new HashMap<>();
int maxLength = 0;
int left = 0;
for (int right = 0; right < s.length(); right++) {
char char = s.charAt(right);
// 如果字符已存在且在窗口内,移动左边界
if (charIndex.containsKey(char) && charIndex.get(char) >= left) {
left = charIndex.get(char) + 1;
}
// 更新字符位置
charIndex.put(char, right);
// 更新最大长度
maxLength = Math.max(maxLength, right - left + 1);
}
return maxLength;
}
}
```
### Java 代码要点
1. `HashMap` 记录字符索引
2. `charAt()` 遍历字符串
3. `Math.max()` 更新最大值
---