Skip to content

Commit d82ddd4

Browse files
committed
docs: fix HTML escaping in LeetCode docs and add .htmlhintrc
1 parent af0ceb0 commit d82ddd4

12 files changed

Lines changed: 25 additions & 20 deletions

File tree

.htmlhintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"spec-char-escape": false
3+
}

Algorithm/BinarySearch/leetcode/108. Convert Sorted Array to Binary Search Tree/claude sonnet 4.6 adaptive/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class Solution:
359359
nums: 昇順ソートされた整数リスト(重複なし)
360360
361361
Returns:
362-
BST のルートノード。nums が空の場合は None。
362+
BST のルートノード。
363363
364364
Raises:
365365
TypeError: nums がリスト型でない場合

Algorithm/BinarySearch/leetcode/108. Convert Sorted Array to Binary Search Tree/claude sonnet 4.6 adaptive/README_react.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ <h1 class="outfit text-[2.2rem] font-extrabold text-teal-900 mb-1 leading-tight"
299299
# self.right = right
300300

301301
class Solution:
302-
def sortedArrayToBST(self, nums: list[int]) -> Optional["TreeNode"]:
303-
def build(lo: int, hi: int) -> Optional["TreeNode"]:
302+
def sortedArrayToBST(self, nums: list[int]) -&gt; Optional["TreeNode"]:
303+
def build(lo: int, hi: int) -&gt; Optional["TreeNode"]:
304304
# ベースケース:lo &gt; hi のとき空区間 → None を返して再帰終了
305305
# この条件がないと無限ループになり RuntimeError が発生する
306306
if lo &gt; hi:

Algorithm/BinaryTree/leetcode/102. Binary Tree Level Order Traversal/claude sonnet 4.6 extended/README_react.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ <h1 class="outfit text-4xl font-black text-teal-900 mb-1 leading-tight">
326326

327327

328328
class Solution:
329-
def levelOrder(self, root: Optional[TreeNode]) -> list[list[int]]:
329+
def levelOrder(self, root: Optional[TreeNode]) -&gt; list[list[int]]:
330330
# 基底条件: root が None(空ツリー)なら即座に空リストを返す
331331
# None チェックをしないと後続の node.val アクセスでクラッシュする
332332
if root is None:

Algorithm/BinaryTree/leetcode/104. Maximum Depth of Binary Tree/claude sonnet 4.6 extended/README_React.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ <h1 class="outfit text-[2.2rem] font-extrabold text-teal-900 mb-1 leading-tight"
292292
# 業務開発版:反復 BFS(CPython 再帰制限を回避)
293293
# ════════════════════════════════════════════════
294294
class Solution:
295-
def maxDepth(self, root: Optional[TreeNode]) -> int:
295+
def maxDepth(self, root: Optional[TreeNode]) -&gt; int:
296296
# エッジケース:空の木(ノードが1つもない)→ 深さ 0
297297
# 後続の deque 処理に None を入れないための早期リターン
298298
if root is None:
@@ -329,7 +329,7 @@ <h1 class="outfit text-[2.2rem] font-extrabold text-teal-900 mb-1 leading-tight"
329329
# 競技プログラミング版:再帰 DFS(最もシンプル)
330330
# ════════════════════════════════════════════════
331331
class Solution2:
332-
def maxDepth(self, root: Optional[TreeNode]) -> int:
332+
def maxDepth(self, root: Optional[TreeNode]) -&gt; int:
333333
# ベースケース:None = 存在しないノードの深さは 0
334334
# "is None" を使う理由:
335335
# 通常のノードオブジェクトはvalの値にかかわらずtruthyですが、

Algorithm/BinaryTree/leetcode/110. Balanced Binary Tree/claude sonnet 4.6 adaptive/Balanced_Binary_Tree_Go.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ func isBalanced(root *TreeNode) bool {
212212
チームで長期間メンテナンスするプロダクションコードに向きます。Goの慣用句に従い、`error` 戻り値を使ってエラーを明示的に表現します。
213213

214214
```go
215+
import "fmt"
216+
215217
// ErrInvalidTree は木の構造が不正な場合のセンチネルエラー(=パッケージレベルで定義する特定のエラー値)。
216218
// errors.Is(err, ErrInvalidTree) で呼び出し元がエラー種別を確認できる。
217219
var ErrInvalidTree = fmt.Errorf("invalid tree structure")

Algorithm/BinaryTree/leetcode/110. Balanced Binary Tree/claude sonnet 4.6 adaptive/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ right_h = check_height(node.right)
557557
| --- | -------------------------------- | ----------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
558558
| 1 | **空の木** | `root = None` | `True` | ベースケースで即座に `0` を返すため、`check_height(None) = 0 != -1 → True` になることを確認 |
559559
| 2 | **ノード1個** | `root = [1]` | `True` | 左右ともに `None``abs(0-0) = 0 ≤ 1` → 均衡 |
560-
| 3 | **左にのみ子がある(右傾き)** | `root = [1, None, 2]` | `False` | `abs(0-1) = 1` は均衡。さらに `root = [1, None, 2, None, 3]` `abs(0-2) = 2 > 1` で不均衡 |
560+
| 3 | **片側にのみ子がある(右傾き)** | `root = [1, None, 2, None, 3]` | `False` | 高さの差が `abs(0-2) = 2 > 1` となるため不均衡。`[1, None, 2]` の場合は `abs(0-1) = 1` で均衡(`True`)となる。 |
561561
| 4 | **一直線の木(最悪ケース)** | `[1, 2, null, 3, null, 4, ...]` n=5000 | `False` | 再帰の深さが n=5000 に達する。LeetCodeの Python 環境は再帰上限が引き上げられているが、ローカルでは `sys.setrecursionlimit()` が必要になる場合がある |
562562
| 5 | **完全二分木** | n=5000 の完全二分木 | `True` | すべてのノードで `abs(h_left - h_right) ≤ 1` が成立。高さは `O(log n)` |
563563
| 6 | **根のみ不均衡・子は均衡** | `[1, 2, None, 3, 4]` | `False` | 子ノードが均衡でも根ノードで `abs(2-0) = 2 > 1` → 不均衡 |

Algorithm/BinaryTree/leetcode/110. Balanced Binary Tree/claude sonnet 4.6 adaptive/README_react.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ <h1 class="outfit text-4xl font-extrabold text-teal-900 mb-1">
325325
<pre class="line-numbers"><code class="language-python">from typing import Optional
326326

327327
class Solution:
328-
def isBalanced(self, root: Optional[TreeNode]) -> bool:
328+
def isBalanced(self, root: Optional[TreeNode]) -&gt; bool:
329329

330-
def check_height(node: Optional[TreeNode]) -> int:
330+
def check_height(node: Optional[TreeNode]) -&gt; int:
331331
# ベースケース:空のノードは高さ0
332332
# `is None` はPEP 8推奨。None はシングルトンなので is が正確
333333
if node is None:
@@ -347,7 +347,7 @@ <h1 class="outfit text-4xl font-extrabold text-teal-900 mb-1">
347347

348348
# このノードでの均衡チェック
349349
# abs() はC実装の組み込み関数で高速
350-
if abs(left_height - right_height) > 1:
350+
if abs(left_height - right_height) &gt; 1:
351351
return -1 # 番兵値 -1 を返して不均衡を上位へ知らせる
352352

353353
# このノードの高さ = max(左, 右) + 自分の1
@@ -396,7 +396,7 @@ <h1 class="outfit text-4xl font-extrabold text-teal-900 mb-1">
396396
check_height(2) [右] → return 1
397397
check_height(1) [ルート]
398398
left_height=3, right_height=1
399-
abs(3-1) = 2 > 1 → return -1 ← 不均衡!
399+
abs(3-1) = 2 &gt; 1 → return -1 ← 不均衡!
400400

401401
check_height(root) = -1
402402
-1 == -1 → isBalanced = False ✅</pre

public/Algorithm/BinarySearch/leetcode/108. Convert Sorted Array to Binary Search Tree/claude sonnet 4.6 adaptive/README_react.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ <h1 class="outfit text-[2.2rem] font-extrabold text-teal-900 mb-1 leading-tight"
299299
# self.right = right
300300

301301
class Solution:
302-
def sortedArrayToBST(self, nums: list[int]) -> Optional["TreeNode"]:
303-
def build(lo: int, hi: int) -> Optional["TreeNode"]:
302+
def sortedArrayToBST(self, nums: list[int]) -&gt; Optional["TreeNode"]:
303+
def build(lo: int, hi: int) -&gt; Optional["TreeNode"]:
304304
# ベースケース:lo &gt; hi のとき空区間 → None を返して再帰終了
305305
# この条件がないと無限ループになり RuntimeError が発生する
306306
if lo &gt; hi:

public/Algorithm/BinaryTree/leetcode/102. Binary Tree Level Order Traversal/claude sonnet 4.6 extended/README_react.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ <h1 class="outfit text-4xl font-black text-teal-900 mb-1 leading-tight">
326326

327327

328328
class Solution:
329-
def levelOrder(self, root: Optional[TreeNode]) -> list[list[int]]:
329+
def levelOrder(self, root: Optional[TreeNode]) -&gt; list[list[int]]:
330330
# 基底条件: root が None(空ツリー)なら即座に空リストを返す
331331
# None チェックをしないと後続の node.val アクセスでクラッシュする
332332
if root is None:

0 commit comments

Comments
 (0)