Skip to content

Commit 4f33c84

Browse files
committed
docs(105): fix inconsistent comment regarding nonlocal cursor in Python implementation
1 parent 0efa3a1 commit 4f33c84

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

Algorithm/BinaryTree/claude sonnet 4.6 extended/105. Construct Binary Tree from Preorder and Inorder Traversal/Construct_Binary_Tree_from_Preorder_and_Inorder_Traversal_Python.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,7 @@ class Solution:
167167
inorder_index: dict[int, int] = {val: i for i, val in enumerate(inorder)}
168168

169169
# ⑤ preorder を先頭から消費するカーソルを初期化する。
170-
# リストに入れるのは Python の nonlocal が int(不変型)の
171-
# 再代入を外側スコープに反映するために使えるが、
172-
# リストでラップすれば .append/.pop なしで添字書き換えができる。
173-
# ここでは可読性のため nonlocal を使うシンプルな形にする。
170+
# この実装では、リストでラップする手法の代わりに nonlocal な整数カーソル (preorder_idx) を使用して preorder 要素を消費します。
174171
preorder_idx = 0
175172

176173
def build(left: int, right: int) -> Optional[TreeNode]:

public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,8 @@ <h1 class="site-title">
505505
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/BinarySearch/leetcode/81.%20Search%20in%20Rotated%20Sorted%20Array%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Search in Rotated Sorted Array II - Technical Analysis</span></span><span class="file-path">Algorithm/BinarySearch/leetcode/81. Search in Rotated Sorted Array II/Claude/README.html</span></a></li>
506506
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/73.%20Set%20Matrix%20Zeroes/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Set Matrix Zeroes Algorithm - Python Implementation</span></span><span class="file-path">Algorithm/Other/leetcode/73. Set Matrix Zeroes/Claude/README.html</span></a></li>
507507
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Dutch%20National%20Flag/leetcode/75.%20Sort%20Colors/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Sort Colors Algorithm - Interactive Technical Guide</span></span><span class="file-path">Algorithm/Dutch National Flag/leetcode/75. Sort Colors/Claude/README.html</span></a></li>
508-
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/54.%20Spiral%20Matrix/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/54. Spiral Matrix/Claude/README.html</span></a></li>
509508
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/59.%20Spiral%20Matrix%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/59. Spiral Matrix II/Claude/README.html</span></a></li>
509+
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/54.%20Spiral%20Matrix/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/54. Spiral Matrix/Claude/README.html</span></a></li>
510510
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/90.%20Subsets%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Subsets II - 反復的拡張法による重複排除 | アルゴリズム解説</span></span><span class="file-path">Algorithm/Other/leetcode/90. Subsets II/Claude/README.html</span></a></li>
511511
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/TwoPointers/leetcode/80.%20Remove%20Duplicates%20from%20Sorted%20Array%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Two-Pointer Algorithm: Remove Duplicates from Sorted Array II</span></span><span class="file-path">Algorithm/TwoPointers/leetcode/80. Remove Duplicates from Sorted Array II/Claude/README.html</span></a></li>
512512
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/BinarySearch/leetcode/34.%20Find%20First%20and%20Last%20Position%20of%20Element%20in%20Sorted%20Array/READEME-typescript.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">TypeScript Binary Search Performance Analysis</span></span><span class="file-path">Algorithm/BinarySearch/leetcode/34. Find First and Last Position of Element in Sorted Array/READEME-typescript.html</span></a></li>
@@ -685,8 +685,8 @@ <h1 class="site-title">
685685
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/BinarySearch/leetcode/81.%20Search%20in%20Rotated%20Sorted%20Array%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Search in Rotated Sorted Array II - Technical Analysis</span></span><span class="file-path">Algorithm/BinarySearch/leetcode/81. Search in Rotated Sorted Array II/Claude/README.html</span></a></li>
686686
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/73.%20Set%20Matrix%20Zeroes/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Set Matrix Zeroes Algorithm - Python Implementation</span></span><span class="file-path">Algorithm/Other/leetcode/73. Set Matrix Zeroes/Claude/README.html</span></a></li>
687687
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Dutch%20National%20Flag/leetcode/75.%20Sort%20Colors/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Sort Colors Algorithm - Interactive Technical Guide</span></span><span class="file-path">Algorithm/Dutch National Flag/leetcode/75. Sort Colors/Claude/README.html</span></a></li>
688-
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/54.%20Spiral%20Matrix/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/54. Spiral Matrix/Claude/README.html</span></a></li>
689688
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/59.%20Spiral%20Matrix%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/59. Spiral Matrix II/Claude/README.html</span></a></li>
689+
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/54.%20Spiral%20Matrix/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/54. Spiral Matrix/Claude/README.html</span></a></li>
690690
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/90.%20Subsets%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Subsets II - 反復的拡張法による重複排除 | アルゴリズム解説</span></span><span class="file-path">Algorithm/Other/leetcode/90. Subsets II/Claude/README.html</span></a></li>
691691
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/TwoPointers/leetcode/80.%20Remove%20Duplicates%20from%20Sorted%20Array%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Two-Pointer Algorithm: Remove Duplicates from Sorted Array II</span></span><span class="file-path">Algorithm/TwoPointers/leetcode/80. Remove Duplicates from Sorted Array II/Claude/README.html</span></a></li>
692692
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/BinarySearch/leetcode/34.%20Find%20First%20and%20Last%20Position%20of%20Element%20in%20Sorted%20Array/READEME-typescript.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">TypeScript Binary Search Performance Analysis</span></span><span class="file-path">Algorithm/BinarySearch/leetcode/34. Find First and Last Position of Element in Sorted Array/READEME-typescript.html</span></a></li>

0 commit comments

Comments
 (0)