Skip to content

2 add two numbers#6

Open
MA-yo-TA wants to merge 4 commits into
mainfrom
2-Add-Two-Numbers
Open

2 add two numbers#6
MA-yo-TA wants to merge 4 commits into
mainfrom
2-Add-Two-Numbers

Conversation

@MA-yo-TA

@MA-yo-TA MA-yo-TA commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Comment on lines +23 to +24
digit = sum % 10
carry = sum // 10

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

divmodという関数が使えますね。

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.

https://docs.python.org/3/library/functions.html#divmod
これですね、存在を知らなかったので勉強になります。ありがとうございます。

dummy_head = ListNode()
node = dummy_head
carry = 0
while node_l1 or node_l2:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

こちらのコメントをご参照ください。
ksaito0629/leetcode_arai60#1 (comment)

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.

ありがとうございます。
スタイルガイドを読んでみて、
None は型の上でも [] などとは異なるということで異なる意味合いで使われることも多いので基本的に区別しておきたいのかなと解釈しました。

参考にします。

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