Skip to content

Commit 4b29aa4

Browse files
committed
docs(leetcode/20): fix markdownlint MD031 and clarify non-deterministic Character reference comparison
1 parent 0d0def0 commit 4b29aa4

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

Algorithm/BinarySearch/leetcode/20. Valid Parentheses/claude sonnet 5/Valid_Parentheses_Java.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,12 @@ class Solution {
239239
> char primitive = boxed; // 自動的にアンボクシングされる
240240
> ```
241241
>
242-
> **応用**:注意が必要なのは、`Character`同士を`==`で比較する場合です。Javaは`\u0000`〜`\u007f`(0〜127、ASCII文字範囲)の値をキャッシュして使い回すため(※`Integer`の`-128`〜`127`とは範囲が異なります)、この範囲内では`==`がたまたま`true`になりますが、範囲外では異なるオブジェクトとして扱われ`false`になることがあります。そのため、オブジェクト比較では`equals()`を使うか、`char`へアンボクシングして値比較を行う必要があります。
242+
> **応用**:注意が必要なのは、`Character`同士を`==`で比較する場合です。Javaは`\u0000`〜`\u007f`(0〜127、ASCII文字範囲)の値をキャッシュして使い回すため(※`Integer`の`-128`〜`127`とは範囲が異なります)、この範囲内では`==`が常に`true`になりますが、範囲外では参照同一性が保証されず、環境やボクシングのされ方によって`true`または`false`になり得ます。そのため、確実に値を比較するには`equals()`を使うか、`char`へアンボクシングして比較を行う必要があります。
243+
>
243244
> ```java
244245
> Character a = '\u0080';
245246
> Character b = '\u0080';
246-
> System.out.println(a == b); // false(キャッシュ範囲外のため別参照
247+
> System.out.println(a == b); // true または false(参照同一性が保証されないため依存
247248
> System.out.println(a.equals(b)); // true(equals による値比較)
248249
> System.out.println((char)a == (char)b); // true(アンボクシングによる値比較)
249250
> ```

public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,8 @@ <h1 class="site-title">
517517
<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>
518518
<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>
519519
<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>
520-
<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>
521520
<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>
521+
<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>
522522
<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>
523523
<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>
524524
<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>
@@ -709,8 +709,8 @@ <h1 class="site-title">
709709
<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>
710710
<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>
711711
<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>
712-
<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>
713712
<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>
713+
<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>
714714
<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>
715715
<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>
716716
<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)