Skip to content

Clone Graph#85

Open
Yuto729 wants to merge 2 commits into
mainfrom
clone-graph
Open

Clone Graph#85
Yuto729 wants to merge 2 commits into
mainfrom
clone-graph

Conversation

@Yuto729

@Yuto729 Yuto729 commented Jul 4, 2026

Copy link
Copy Markdown
Owner

解く問題

Clone Graph

次に解く問題

Repository owner deleted a comment from github-actions Bot Jul 4, 2026
Comment thread clone-graph/main.md
if not node:
return None

head = Node(val=node.val)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

head はリンクトリストの先頭のノードを表すノードです。一般グラフにおいては head という単語は使用しないと思います。 cloned_node のあたりが良いでしょうか。

Comment thread clone-graph/main.md
return None

visited = {}
def clone(node):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

clone という関数名からは、常に node を新しくコピーしたものが返るニュアンスを感じました。自分なら clone_or_get_existing という名前にすると思います。

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.

2 participants