Update 82. Remove Duplicates from Sorted List II.md#12
Conversation
| } | ||
| node->next = next_node; // 重複をスキップ | ||
| } | ||
| else { |
There was a problem hiding this comment.
elseで改行されていると少し読み辛いと感じました。
参考にこの辺りのガイドを共有いたします。
https://google.github.io/styleguide/cppguide.html#Formatting_Looping_Branching
There was a problem hiding this comment.
スタイルは色々な流派があります。改行の単位まで場合によってはこだわります。
ただ、優先順位としてはデザイン、どこにどう配置するかなどのほうが重要度はだいぶ上です。
https://discord.com/channels/1084280443945353267/1366778718705553520/1377689037208289471
スタイルガイドについてはコメント集に少し書いたかと思います。
There was a problem hiding this comment.
@Ryotaro25
スタイルの共有ありがとうございます。
私のスタイルは、提示いただいたgoogleのものを参考に基準を養っていきたいと思ってましたが、確認できていませんでした。頂くコメントを予測して、振り返ることを忘れずにしたいと思います。
There was a problem hiding this comment.
@oda
コメントありがとうございます。
こちらのdiscord確認できていませんでした。レビューの仕方と見るべきポイント確認しておきます。
| bool has_duplicates = next_node->next && next_node->val == next_node->next->val; | ||
|
|
||
| if (has_duplicates) { | ||
| int dup_val = next_node->val; // 重複部分をすべて delete |
| ListNode* next_node = head; | ||
|
|
||
| while (node && next_node) { | ||
| bool has_duplicates = next_node->next && next_node->val == next_node->next->val; |
| 他の方のGitHubを確認 | ||
| *https://github.com/maeken4/Arai60/pull/4/commits/32508ad2702b7c64d55f45023bfd816fa33358c3 | ||
| maeken さん | ||
| 野田さんのコメント:std::unique_ptr や std::shared_ptr の使い方を確認:https://cpprefjp.github.io/reference/memory/unique_ptr.html |
There was a problem hiding this comment.
ご存知でしたらすみません。Effective C++にこの辺りのことがいくつか書かれております。
この会でも何度か紹介されておりますので共有いたします。
There was a problem hiding this comment.
@Ryotaro25
コメントありがとうございます!
リンクが添付されてないみたいです。お手隙で共有頂けたらと思います。
There was a problem hiding this comment.
すみませんこちらは書籍になります🙇
https://amzn.asia/d/1fDsGyd
This:https://leetcode.com/problems/remove-duplicates-from-sorted-list-ii/description/
Next:https://leetcode.com/problems/add-two-numbers/description/