Open
Conversation
Comment on lines
+38
to
+41
| while fast != slow: | ||
| fast = fast.next | ||
| slow = slow.next | ||
|
|
There was a problem hiding this comment.
ここのみ違っていたため直し忘れかと思いますが、今回は同一性を確かめる必要があるため、is not が適切のように思います。
Suggested change
| while fast != slow: | |
| fast = fast.next | |
| slow = slow.next | |
| while fast is not slow: | |
| fast = fast.next | |
| slow = slow.next | |
|
一点コメントしましたが、それ以外の部分は読みやすかったです! |
t9a-dev
reviewed
Nov 25, 2025
| slow = slow.next | ||
| fast = fast.next.next | ||
|
|
||
| # デフォルトでは, __eq__メソッドではオブジェクトの等価性を見ているので `==` で記述しても同じだが以下のように記述するほうが厳密. `is`はポインタの比較? |
There was a problem hiding this comment.
以下のようにドキュメントに記載があり、id()はオブジェクトのメモリアドレスを取得するとあります。ポインタが指すメモリアドレスの同一性チェックという意味で大丈夫そうです。
オブジェクトの同一性は id() 関数を使って判定されます。
https://docs.python.org/ja/3/reference/expressions.html#is-not
fv17
reviewed
Nov 28, 2025
Comment on lines
+110
to
+111
| from_start = head | ||
| from_intersection = intersection |
There was a problem hiding this comment.
from_start, from_intersection の変数名分かりやすかったです。
from_head もアリな気がしました。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
解く問題
Linked List Cycle Ⅱ
次に解く問題
Remove Duplicates From Sorted List