Conversation
競技プロ就活部PR用/2. Add Two Numbers.md
Outdated
There was a problem hiding this comment.
私ならvalue1, value2 = get_value(l1), get_value(l2)と一行で書きたくなります
競技プロ就活部PR用/2. Add Two Numbers.md
Outdated
There was a problem hiding this comment.
私はこの関数名をmoveNodeとしていましたが、moveしない場合があるのでnext_nodeの方が良さそうですね
競技プロ就活部PR用/2. Add Two Numbers.md
Outdated
There was a problem hiding this comment.
dummy が使う値ならば dummy という名称はちょっとずれている気がしますね。
競技プロ就活部PR用/2. Add Two Numbers.md
Outdated
There was a problem hiding this comment.
なるほどです。ありがうございます。確かに、1個目はdummyというより、added_headとかが良いですね。意識できていなかったので、覚えておきます。
競技プロ就活部PR用/2. Add Two Numbers.md
Outdated
There was a problem hiding this comment.
三項演算子にしても良いかなと思いました。Python の記法は独特で、嫌いだと言っている人も見たことがありますが、処理を英語で読み上げているような感じがして私は結構好きです。
| if node is None: | |
| return 0 | |
| return node.val | |
| return node.val if node else 0 |
There was a problem hiding this comment.
有難うございます。特に考えずこの書き方していましたが、三項演算子のほうが自分的にも見やすいです。
Python の記法は独特で、嫌いだと言っている人も見たことがあります
存じ上げなかったです。自分も特に違和感ないです。
競技プロ就活部PR用/2. Add Two Numbers.md
Outdated
There was a problem hiding this comment.
ありがとうございます。そうですね、特にメリットないので中で別で変数作った方がわかりやすいですね。
競技プロ就活部PR用/2. Add Two Numbers.md
Outdated
There was a problem hiding this comment.
https://github.com/Mike0121/LeetCode/pull/41/files#r1695305381
と指摘内容が被りますが
value1,value2への代入をやめると、余計な変数を増やさずに済むのでコードがシンプルになって読みやすくなりそうです。
There was a problem hiding this comment.
有難うございます。確かにこの変数減らせますね。そっちの方が良さそうです。
https://leetcode.com/problems/add-two-numbers/description/