Skip to content

Commit a2006a6

Browse files
committed
docs(two-sum): fix inaccuracies in flowchart and complexity description
- Update Mermaid flowchart and flow description to reflect ValueError on no solution. - Correct duplicate handling description (updating instead of skipping). - Fix O(n log n) description to 'sorting + binary search' in README table.
1 parent 662f711 commit a2006a6

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

DataStructures/Map/leetcode/claude sonnet 4.6 adaptive/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ graph LR
223223
| ------------ | ---------------------- | --------------------------- |
224224
| `O(1)` | 入力サイズによらず一定 | 辞書で直接ページを開く |
225225
| `O(n)` | 入力に比例して増加 | リストを端から順に読む |
226-
| `O(n log n)` | n よりやや速く増加 | 辞書を二分探索で引く × n 回 |
226+
| `O(n log n)` | n よりやや速く増加 | ソート + 二分探索 |
227227
| `O(n²)` | 入力の 2 乗で増加 | 全ペアを総当たりで確認する |
228228

229229
### 本解法の計算量

DataStructures/Map/leetcode/claude sonnet 4.6 adaptive/README_react.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ <h3 class="text-teal-800 font-bold text-lg mb-3">入出力例</h3>
472472
Record["⑦ seen[x] = i を登録"]
473473
Done["配列終了
474474
※制約上は到達しない
475-
[-1,-1] を返却"]
475+
ValueError を送出"]
476476
End(["⑧ 終了"])
477477

478478
S --> Init
@@ -544,15 +544,13 @@ <h3 class="text-teal-800 font-bold text-lg mb-3">入出力例</h3>
544544
<code class="px-2 py-0.5 bg-white rounded mono text-xs">[seen[need], i]</code>
545545
を返却<br />
546546
5. 存在しなければ、<code class="px-2 py-0.5 bg-white rounded mono text-xs"
547-
>x</code
547+
>seen[x] = i</code
548548
>
549-
が辞書に未登録なら
550-
<code class="px-2 py-0.5 bg-white rounded mono text-xs">seen[x] = i</code>
551-
を登録(重複はスキップ)<br />
549+
を実行して現在の値を記録(同値があればインデックスを更新)<br />
552550
6. 次の要素へ進む(ループバック)<br />
553551
7. 全要素を処理しても解が見つからなければ
554-
<code class="px-2 py-0.5 bg-white rounded mono text-xs">[-1, -1]</code>
555-
を返却(問題前提では到達しない)
552+
<code class="px-2 py-0.5 bg-white rounded mono text-xs">ValueError</code>
553+
を送出(問題前提では到達しない)
556554
</div>
557555
</section>
558556

public/DataStructures/Map/leetcode/claude sonnet 4.6 adaptive/README_react.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ <h3 class="text-teal-800 font-bold text-lg mb-3">入出力例</h3>
472472
Record["⑦ seen[x] = i を登録"]
473473
Done["配列終了
474474
※制約上は到達しない
475-
[-1,-1] を返却"]
475+
ValueError を送出"]
476476
End(["⑧ 終了"])
477477

478478
S --> Init
@@ -544,15 +544,13 @@ <h3 class="text-teal-800 font-bold text-lg mb-3">入出力例</h3>
544544
<code class="px-2 py-0.5 bg-white rounded mono text-xs">[seen[need], i]</code>
545545
を返却<br />
546546
5. 存在しなければ、<code class="px-2 py-0.5 bg-white rounded mono text-xs"
547-
>x</code
547+
>seen[x] = i</code
548548
>
549-
が辞書に未登録なら
550-
<code class="px-2 py-0.5 bg-white rounded mono text-xs">seen[x] = i</code>
551-
を登録(重複はスキップ)<br />
549+
を実行して現在の値を記録(同値があればインデックスを更新)<br />
552550
6. 次の要素へ進む(ループバック)<br />
553551
7. 全要素を処理しても解が見つからなければ
554-
<code class="px-2 py-0.5 bg-white rounded mono text-xs">[-1, -1]</code>
555-
を返却(問題前提では到達しない)
552+
<code class="px-2 py-0.5 bg-white rounded mono text-xs">ValueError</code>
553+
を送出(問題前提では到達しない)
556554
</div>
557555
</section>
558556

0 commit comments

Comments
 (0)