Skip to content

feat: add solution and documentation for LeetCode 66. Plus One#241

Merged
myoshi2891 merged 1 commit into
mainfrom
dev-from-macmini
Jan 25, 2026
Merged

feat: add solution and documentation for LeetCode 66. Plus One#241
myoshi2891 merged 1 commit into
mainfrom
dev-from-macmini

Conversation

@myoshi2891

Copy link
Copy Markdown
Owner
  • Added Python and TypeScript solutions in IPYNB format
  • Added comprehensive README.md in Japanese
  • Added interactive README_react.html documentation

- Added Python and TypeScript solutions in IPYNB format
- Added comprehensive README.md in Japanese
- Added interactive README_react.html documentation
@coderabbitai

coderabbitai Bot commented Jan 25, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Summary by CodeRabbit

リリースノート

  • 新機能

    • アルゴリズムの段階的な対話的ビジュアライゼーション機能を追加しました。
  • ドキュメント

    • 複数のプログラミング言語による実装例を含む包括的なドキュメントを追加しました。
    • 問題分析、エッジケース、時間空間複雑性分析、最適化手法に関する詳細なガイドを提供します。

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

LeetCode 66(プラスワン)問題の包括的なドキュメンテーションとリファレンス実装を新規追加。Python、TypeScriptの実装ノートブック、詳細なREADMEドキュメント、およびReact対応のインタラクティブなHTML説明資料で構成。

Changes

コホート / ファイル 変更内容
実装ノートブック
Algorithm/Other/leetcode/66. Plus One/Claude Sonnet 4.5/PlusOne_python.ipynb, PlusOne_typescript.ipynb
Python/TypeScriptでのプラスワン実装を新規追加。入力検証、エラーハンドリング、複数の実装バリアント、最適化ノート、エッジケース例を含む。TypeScriptではイミュータブル変種も提供。
ドキュメンテーション
Algorithm/Other/leetcode/66. Plus One/Claude Sonnet 4.5/README.md
アルゴリズム解説、Mermaidフローチャート、実行トレース、計算量分析、実装バリアント、CPython最適化、FAQ、テスト検証リストを網羅した詳細ドキュメント。
インタラクティブUI
Algorithm/Other/leetcode/66. Plus One/Claude Sonnet 4.5/README_react.html
Tailwind CSS、Prism、React(CDN)を使用したステップバイステップの視覚化ツール。自動再生機能、クリック操作対応のステップ表示、コードハイライト(Python/TypeScript)を実装。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

六十六の問題に、ウサギが答える🐰
プラス・ワンして、キャリー運ぶ右から左へ
ドキュメント咲き、Reactで輝く✨
インタラクティブな視覚化で、みんなが学べる道
最適化のコツまで添えて、完成だ!🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PRタイトルはLeetCode 66 Plus Oneのソリューションとドキュメンテーション追加という主要な変更を明確かつ簡潔に要約しており、変更セットと完全に関連している。
Description check ✅ Passed PR説明は提供されたファイル(Python/TypeScriptソリューション、README.md、README_react.html)の追加について述べており、変更セットと関連している。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Fix all issues with AI agents
In `@Algorithm/Other/leetcode/66`. Plus One/Claude Sonnet
4.5/PlusOne_python.ipynb:
- Around line 192-199: The input validation loop over digits incorrectly accepts
booleans because isinstance(digit, int) returns True for bool; update the check
in the loop that currently reads "for i, digit in enumerate(digits):" to exclude
bools—e.g., replace the isinstance(digit, int) check with a strict type check
such as type(digit) is int or add an extra condition like isinstance(digit, int)
and not isinstance(digit, bool) so that True/False are rejected before the range
check in the function handling digits (the loop using variables i and digit).

In `@Algorithm/Other/leetcode/66`. Plus One/Claude Sonnet
4.5/PlusOne_typescript.ipynb:
- Around line 23-26: The documentation claim that `number[]` guarantees digits
0–9 is incorrect; either change the doc line ("型定義で 0-9 の範囲を保証") to state that
TypeScript cannot enforce numeric ranges and runtime validation is required, or
add runtime checks in the implementation (e.g., in the function handling the
input—referenced as the `readonly number[]` argument handling and the logic
around lines 76–79) that iterate the input digits and throw or return an error
if any element is not an integer in [0,9]; update tests/comments accordingly to
reflect the chosen approach.

In `@Algorithm/Other/leetcode/66`. Plus One/Claude Sonnet 4.5/README_react.html:
- Around line 8-31: The HTML includes remote CDN assets for Tailwind (the
<script src="https://cdn.tailwindcss.com"></script>), Google Fonts link tags,
and Prism.js CSS links without Subresource Integrity or production-optimized
builds; update these tags to use SRI and crossorigin attributes (add
integrity="..." and crossorigin="anonymous" to each CDN link), replace any
dev/standalone builds with their production/minified URLs (use
prism-tomorrow.min.css and prod Tailwind build or a locally built CSS), and
preferably vendor the built assets (prebuild Tailwind and Prism during your
build process and serve locally) to avoid using babel-standalone or runtime CDN
transforms; ensure the same changes are applied to the other occurrences of
these tags referenced in the diff (the Tailwind script tag, the Google
Fonts/preconnect links, and the Prism CSS link elements).

In `@Algorithm/Other/leetcode/66`. Plus One/Claude Sonnet 4.5/README.md:
- Around line 319-325: 現在の入力検証で isinstance(digit, int) が True/False
を許してしまうため、ループ内の型チェックを bool を明示的に除外するよう修正してください(参照箇所: 変数 digits を走査している for
ループ、エラーは TypeError を投げる処理)。たとえば type(digit) is int を使するか、isinstance(digit, int)
and not isinstance(digit, bool) のようにして bool を弾き、既存の ValueError
チェックやエラーメッセージ(f"Element at index {i} must be an integer")はそのまま維持してください。
- Around line 556-570: Update the LeetCode Python version note in the Q6 section
(the paragraph stating "LeetCodeはPython 3.11+なので `list[int]` が標準。") to reflect
the current environment: either change the explicit version to "Python 3.14" or
remove the specific version and make it version-agnostic by saying "`list[int]`
is available in Python 3.9+ (PEP 585) and is the recommended annotation"; ensure
the surrounding explanation for def plusOne(...) and the examples using
`list[int]` vs `List[int]` remain consistent with that change.
- Around line 348-358: Update the README text to avoid absolute performance
claims about "[1, *digits]" vs "[1] + digits": remove the statements about fixed
"copy counts" and "約10-20%の高速化", and replace them with a note that performance
depends on input size (small lists may show a modest advantage for the spread
form while large lists are similar) and that readability should guide choice;
reference the two forms "[1, *digits]" and "[1] + digits" in the new wording so
readers can locate the examples.

Comment on lines +192 to +199
" for i, digit in enumerate(digits):\n",
" if not isinstance(digit, int):\n",
" raise TypeError(f\"Element at index {i} must be an integer\")\n",
" \n",
" if not 0 <= digit <= 9:\n",
" raise ValueError(\n",
" f\"Element at index {i} ({digit}) must be in range [0, 9]\"\n",
" )\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "PlusOne_python.ipynb" -type f

Repository: myoshi2891/Algorithm-DataStructures-Math-SQL

Length of output: 166


🏁 Script executed:

wc -l "./Algorithm/Other/leetcode/66. Plus One/Claude Sonnet 4.5/PlusOne_python.ipynb"

Repository: myoshi2891/Algorithm-DataStructures-Math-SQL

Length of output: 170


🏁 Script executed:

cat -n "./Algorithm/Other/leetcode/66. Plus One/Claude Sonnet 4.5/PlusOne_python.ipynb" | sed -n '180,210p'

Repository: myoshi2891/Algorithm-DataStructures-Math-SQL

Length of output: 1564


🏁 Script executed:

python3 << 'EOF'
# Verify if bool is instance of int in Python
print("isinstance(True, int):", isinstance(True, int))
print("isinstance(False, int):", isinstance(False, int))
print("isinstance(True, bool):", isinstance(True, bool))
print("isinstance(False, bool):", isinstance(False, bool))

# Test the validation logic
digit = True
if not isinstance(digit, int):
    print("Would raise TypeError for True")
else:
    print("True passes isinstance(digit, int) check")

# Test the proposed fix
digit = True
if not isinstance(digit, int) or isinstance(digit, bool):
    print("With fix: True would raise TypeError")
else:
    print("With fix: True would still pass")
EOF

Repository: myoshi2891/Algorithm-DataStructures-Math-SQL

Length of output: 281


bool が整数として通過してしまう入力検証

isinstance(digit, int) を使用していますが、Pythonでは boolint のサブクラスであるため、TrueFalse が整数として許可されてしまいます。より厳密な型検証が必要な場合は bool を除外してください。

修正案
-            if not isinstance(digit, int):
+            if not isinstance(digit, int) or isinstance(digit, bool):
                 raise TypeError(f"Element at index {i} must be an integer")
🤖 Prompt for AI Agents
In `@Algorithm/Other/leetcode/66`. Plus One/Claude Sonnet 4.5/PlusOne_python.ipynb
around lines 192 - 199, The input validation loop over digits incorrectly
accepts booleans because isinstance(digit, int) returns True for bool; update
the check in the loop that currently reads "for i, digit in enumerate(digits):"
to exclude bools—e.g., replace the isinstance(digit, int) check with a strict
type check such as type(digit) is int or add an extra condition like
isinstance(digit, int) and not isinstance(digit, bool) so that True/False are
rejected before the range check in the function handling digits (the loop using
variables i and digit).

Comment on lines +23 to +26
"### TypeScript特有の考慮点\n",
"- **型推論**: `number[]` の厳密な型定義で0-9の範囲を保証\n",
"- **readonly**: 引数を `readonly number[]` にすると副作用を防げる(要新配列生成)\n",
"- **型ガード**: 実行時の配列要素検証\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

find . -name "PlusOne_typescript.ipynb" -type f

Repository: myoshi2891/Algorithm-DataStructures-Math-SQL

Length of output: 170


🏁 Script executed:

cat -n "./Algorithm/Other/leetcode/66. Plus One/Claude Sonnet 4.5/PlusOne_typescript.ipynb"

Repository: myoshi2891/Algorithm-DataStructures-Math-SQL

Length of output: 9974


number[] 型では 0~9 の値域を保証できない

24 行目の「型定義で 0-9 の範囲を保証」は TypeScript の型システムでは実現できません。現在の実装(76~79 行目)は配列の存在確認のみで、各要素の値域チェックがありません。ランタイム検証を追加するか、ドキュメントを「型では保証できず、ランタイム検証が必要」と修正してください。

値域検証の追加例
function plusOne(digits: number[]): number[] {
    // 型ガード: 配列の検証
    if (!Array.isArray(digits) || digits.length === 0) {
        throw new TypeError('Input must be a non-empty array');
    }
+    for (const [i, d] of digits.entries()) {
+        if (!Number.isInteger(d) || d < 0 || d > 9) {
+            throw new TypeError(`Element at index ${i} must be an integer in [0, 9]`);
+        }
+    }

Also applies to: 75-90

🤖 Prompt for AI Agents
In `@Algorithm/Other/leetcode/66`. Plus One/Claude Sonnet
4.5/PlusOne_typescript.ipynb around lines 23 - 26, The documentation claim that
`number[]` guarantees digits 0–9 is incorrect; either change the doc line ("型定義で
0-9 の範囲を保証") to state that TypeScript cannot enforce numeric ranges and runtime
validation is required, or add runtime checks in the implementation (e.g., in
the function handling the input—referenced as the `readonly number[]` argument
handling and the logic around lines 76–79) that iterate the input digits and
throw or return an error if any element is not an integer in [0,9]; update
tests/comments accordingly to reflect the chosen approach.

Comment on lines +8 to +31
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>

<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=JetBrains+Mono:wght@400;600&family=Source+Code+Pro:wght@400;600;700&display=swap"
rel="stylesheet"
/>

<!-- Prism.js CSS -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/line-numbers/prism-line-numbers.min.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/toolbar/prism-toolbar.min.css"
/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

CDN アセットに SRI/本番ビルドが無く供給チェーンリスク

公開配布やホスティング前提なら、CDN 取得の React/Tailwind/Prism/Babel には integrity を付与し、可能なら production ビルド+事前ビルド(Babel standalone 回避)で安全性と性能を上げることを推奨します。

Also applies to: 926-942

🤖 Prompt for AI Agents
In `@Algorithm/Other/leetcode/66`. Plus One/Claude Sonnet 4.5/README_react.html
around lines 8 - 31, The HTML includes remote CDN assets for Tailwind (the
<script src="https://cdn.tailwindcss.com"></script>), Google Fonts link tags,
and Prism.js CSS links without Subresource Integrity or production-optimized
builds; update these tags to use SRI and crossorigin attributes (add
integrity="..." and crossorigin="anonymous" to each CDN link), replace any
dev/standalone builds with their production/minified URLs (use
prism-tomorrow.min.css and prod Tailwind build or a locally built CSS), and
preferably vendor the built assets (prebuild Tailwind and Prism during your
build process and serve locally) to avoid using babel-standalone or runtime CDN
transforms; ensure the same changes are applied to the other occurrences of
these tags referenced in the diff (the Tailwind script tag, the Google
Fonts/preconnect links, and the Prism CSS link elements).

Comment on lines +319 to +325
for i, digit in enumerate(digits):
if not isinstance(digit, int):
raise TypeError(f"Element at index {i} must be an integer")

if not 0 <= digit <= 9:
raise ValueError(
f"Element at index {i} ({digit}) must be in range [0, 9]"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's find and check the file
find . -name "README.md" -path "*66. Plus One*" 2>/dev/null | head -5

Repository: myoshi2891/Algorithm-DataStructures-Math-SQL

Length of output: 155


🏁 Script executed:

# Check Python version and bool subclass relationship
python3 << 'EOF'
# Verify that bool is a subclass of int
print("bool is subclass of int:", issubclass(bool, int))
print("isinstance(True, int):", isinstance(True, int))
print("isinstance(False, int):", isinstance(False, int))
print("isinstance(True, bool):", isinstance(True, bool))
print("isinstance(1, bool):", isinstance(1, bool))
EOF

Repository: myoshi2891/Algorithm-DataStructures-Math-SQL

Length of output: 230


🏁 Script executed:

# Read the README.md file at the specified lines
sed -n '315,330p' "./Algorithm/Other/leetcode/66. Plus One/Claude Sonnet 4.5/README.md"

Repository: myoshi2891/Algorithm-DataStructures-Math-SQL

Length of output: 675


bool が整数として通ってしまう入力検証

Python では boolint のサブクラスのため、isinstance(digit, int) だと True/False が許可されてしまいます。入力検証で bool を明示的に除外してください。

修正案
-            if not isinstance(digit, int):
+            if not isinstance(digit, int) or isinstance(digit, bool):
                 raise TypeError(f"Element at index {i} must be an integer")
🤖 Prompt for AI Agents
In `@Algorithm/Other/leetcode/66`. Plus One/Claude Sonnet 4.5/README.md around
lines 319 - 325, 現在の入力検証で isinstance(digit, int) が True/False
を許してしまうため、ループ内の型チェックを bool を明示的に除外するよう修正してください(参照箇所: 変数 digits を走査している for
ループ、エラーは TypeError を投げる処理)。たとえば type(digit) is int を使するか、isinstance(digit, int)
and not isinstance(digit, bool) のようにして bool を弾き、既存の ValueError
チェックやエラーメッセージ(f"Element at index {i} must be an integer")はそのまま維持してください。

Comment on lines +348 to +358
### 2. スプレッド演算子によるリスト結合

```python
# 推奨: スプレッド演算子(Python 3.5+)
return [1, *digits]

# 非推奨: リスト結合(コピーが2回発生)
return [1] + digits
```

**効果**: メモリコピーの回数削減、約10-20%の高速化

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

[1, *digits] vs [1] + digits Python performance benchmark

💡 Result:

For digits being a list, these two are usually very close in CPython performance:

  • a = [1, *digits] (list display + starred-unpack)
  • a = [1] + digits (list concatenation)

Why they’re close

  • Starred-unpacking in list displays (introduced by PEP 448) compiles to bytecode that builds a list and then extends it (notably via LIST_EXTEND). [1][2]
  • + on lists creates a new list and copies elements from both operands (still linear time overall). List concatenation is generally described as linear in the total size. [3]

So both are effectively O(len(digits)) work plus allocation/copying.

When one can win

  • If digits is already a list, [1] + digits can be slightly faster in some builds because it can allocate the final size in one go and copy. (Microbench-dependent.)
  • If digits is not a list (e.g., a generator/range/tuple), [1] + digits either errors (non-list) or forces a conversion, while [1, *digits] works with any iterable (but may pay iteration/conversion costs). PEP 448 explicitly defines this iterable-unpacking behavior. [1]

Benchmark it on your Python (recommended)

import timeit

setup = "digits = list(range(1000))"
print(timeit.timeit("[1, *digits]", setup=setup, number=200_000))
print(timeit.timeit("[1] + digits", setup=setup, number=200_000))

If you tell me your Python version (e.g., 3.10/3.11/3.12/3.13) and typical len(digits), I can suggest a more representative benchmark (and pitfalls to avoid).

Sources: PEP 448 starred-unpacking in displays [1]; CPython bytecode LIST_EXTEND used to build lists [2]; list concatenation time complexity discussion [3].

[1] (peps.python.org)
[2] (docs.python.org)
[3] (geeksforgeeks.org)

Citations:


🌐 Web query:

CPython list unpacking operator performance vs concatenation

💡 Result:

In CPython, for two existing lists:

  • a + b is usually fastest because CPython’s list_concat allocates exactly one new list of size len(a)+len(b) and then copies references from a and b into it. [1]
  • [*a, *b] is compiled as “build a new list, then extend it for each * part” (CPython uses list-building opcodes like LIST_EXTEND). Each extend can trigger its own growth/resize logic, so it commonly has a bit more overhead than a single dedicated concat. [2][3][4]

For more than two inputs, the trade-off changes:

  • Repeated + (e.g. a + b + c + d) is typically worst because it creates intermediate temporary lists at each +.
  • [*a, *b, *c, *d] avoids those intermediate temporaries (still makes the final list), so it often wins versus chained + for many parts. The syntax/semantics come from PEP 448. [2]

If you don’t need a new list (you want to mutate in place), a.extend(b) / a += b is typically best (it grows a and copies in elements once). The underlying extend path tries to pre-grow based on an iterator length hint when available. [4]

Rule of thumb (CPython):

  • New list from two lists: prefer a + b. [1]
  • Combine many iterables into a new list: prefer [*it1, *it2, ...] (or list(itertools.chain.from_iterable(...)) when inputs are dynamic).
  • Mutate an existing list: prefer extend / +=. [4]

Sources: [1] CPython list_concat_lock_held in Objects/listobject.c (prealloc + copy). [2] PEP 448 (unpacking in list displays). [3] dis docs for LIST_EXTEND (“Used to build lists”). [4] CPython list_extend_iter_lock_held / resize logic in Objects/listobject.c.


🏁 Script executed:

#!/bin/bash
# Let's create a simple benchmark to test both approaches
python3 << 'EOF'
import timeit

# Test with different input sizes
for size in [10, 100, 1000]:
    digits = list(range(size))
    
    # Approach 1: unpacking operator
    t1 = timeit.timeit(lambda: [1, *digits], number=100000)
    
    # Approach 2: concatenation
    t2 = timeit.timeit(lambda: [1] + digits, number=100000)
    
    diff_percent = ((t2 - t1) / t2) * 100 if t2 > 0 else 0
    
    print(f"Size {size}:")
    print(f"  [1, *digits]:  {t1:.4f}s")
    print(f"  [1] + digits:  {t2:.4f}s")
    print(f"  Difference: {diff_percent:.1f}% (unpacking is {'faster' if t1 < t2 else 'slower'})")
    print()
EOF

Repository: myoshi2891/Algorithm-DataStructures-Math-SQL

Length of output: 395


[1, *digits][1] + digits の性能差は入力サイズに依存

「コピー回数」や「10–20%高速化」は絶対的ではありません。ベンチマークによると、サイズが小さい場合(10–100要素)は [1, *digits] がやや速いものの、大規模な入力ではほぼ同等です。性能を理由に一方を強く推奨するより、可読性で選択することをお勧めします。

文言の調整例
-# 非推奨: リスト結合(コピーが2回発生)
+# 参考: 実装差は小さいため可読性を優先して選択してよい
 return [1] + digits
@@
-**効果**: メモリコピーの回数削減、約10-20%の高速化
+**効果**: 実装・入力サイズに依存するため、必要ならベンチマークで確認
🤖 Prompt for AI Agents
In `@Algorithm/Other/leetcode/66`. Plus One/Claude Sonnet 4.5/README.md around
lines 348 - 358, Update the README text to avoid absolute performance claims
about "[1, *digits]" vs "[1] + digits": remove the statements about fixed "copy
counts" and "約10-20%の高速化", and replace them with a note that performance depends
on input size (small lists may show a modest advantage for the spread form while
large lists are similar) and that readability should guide choice; reference the
two forms "[1, *digits]" and "[1] + digits" in the new wording so readers can
locate the examples.

Comment on lines +556 to +570
### Q6: 型ヒント `List[int]` vs `list[int]` の使い分けは?

**A**: Python 3.9+では `list[int]` が推奨(PEP 585):

```python
# Python 3.9+(推奨)
def plusOne(self, digits: list[int]) -> list[int]:

# Python 3.8以前(後方互換)
from typing import List
def plusOne(self, digits: List[int]) -> List[int]:
```

LeetCodeはPython 3.11+なので `list[int]` が標準。

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

LeetCode Python runtime version 2025 2026

💡 Result:

LeetCode’s official “Languages environment” page (updated Jan 6, 2026) lists:

  • Python (legacy): 2.7.18
  • Python3: 3.14 (this is what you typically want for LeetCode submissions)  [1]

Source: LeetCode Help Center → “What are the environments for the programming languages?” [1]

References:
[1] (support.leetcode.com)

Citations:


LeetCode の Python バージョン表記を更新してください

ドキュメント内の「LeetCodeはPython 3.11+なので」という記載は不正確です。LeetCode の公式ページ(2026年1月6日更新)によると、現在の実行環境は Python 3.14 です。このため、記載内容を以下のいずれかで修正してください:

  • 最新バージョン(3.14)に更新する
  • バージョン非依存の表現にする(例:「list[int] は Python 3.9+ で利用可能」のみに統一)

実行環境は定期的に更新されるため、具体的なバージョン番号を記載する場合は、公式ページで常に最新状態を確認することをお勧めします。

🤖 Prompt for AI Agents
In `@Algorithm/Other/leetcode/66`. Plus One/Claude Sonnet 4.5/README.md around
lines 556 - 570, Update the LeetCode Python version note in the Q6 section (the
paragraph stating "LeetCodeはPython 3.11+なので `list[int]` が標準。") to reflect the
current environment: either change the explicit version to "Python 3.14" or
remove the specific version and make it version-agnostic by saying "`list[int]`
is available in Python 3.9+ (PEP 585) and is the recommended annotation"; ensure
the surrounding explanation for def plusOne(...) and the examples using
`list[int]` vs `List[int]` remain consistent with that change.

@myoshi2891 myoshi2891 merged commit e22ef0a into main Jan 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant