Skip to content

Solve 82. Remove Duplicates from Sorted List II (step 1, 2)#9

Open
cheeseNA wants to merge 3 commits intomainfrom
82
Open

Solve 82. Remove Duplicates from Sorted List II (step 1, 2)#9
cheeseNA wants to merge 3 commits intomainfrom
82

Conversation

@cheeseNA
Copy link
Copy Markdown
Owner

Problem link
参照した他の解答についてはnote.mdに記載しております.

while cursor.next and cursor.val == cursor.next.val:
cursor = cursor.next
cursor = cursor.next
if not cursor:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

これはループの外のほうがいいのではないでしょうか。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

コメントありがとうございます!そうですね, 他の方のコードを見て外に出せることに気付きました.

sentinel = ListNode()
last_unique_node = sentinel
cursor = head
remove_value = None
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

変数名が動詞で始まっているのに違和感があります。value_to_removeとかでしょうか。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

たしかにおっしゃる通りですね!ありがとうございます

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.

3 participants