Open
Conversation
huyfififi
reviewed
Aug 18, 2025
| ``` | ||
|
|
||
| - ポインタの反転版 (走査しながら リンクの向きを1本ずつ逆向きに付け替えるだけ)という考え方もある。 | ||
| -> stackを使わないという点では、この問題意図とは異なるが、一つの例として。 |
There was a problem hiding this comment.
私がもし、Stackで入力をひっくり返す、というテクニックを問いたいなら、Linked Listではなくもう少しシンプルな問題設計をするように思います。Linked Listを扱う問題なら、繋ぎかえが正しく行えるかが難しく、見たいところような気がするので、こちらが想定解かもしれませんね。
Owner
Author
There was a problem hiding this comment.
@huyfififi
ご返信随分と遅くなり大変申し訳ございません。
ご意見頂きありがとうございます。
確かにLinked Listを扱う問題であれば、正しく繋ぎかえができるかがみたいと考えるのがみたい所ですかね。
改めて問題意図を意識して、書いてみようと思います。
|
|
||
| ``` | ||
| while (node)と記載していたが、pointerを条件式で使用すると、boolへ変換される。e.g. nullptr->false、非nullptr->true | ||
| 可読性という点で、while (node) だとbool? int? と一瞬考えると感じ、上記の書き方のまま採用した。参考:https://google.github.io/styleguide/cppguide.html#Boolean_Expressions |
There was a problem hiding this comment.
以前私が調べた限りでは、どちらの派閥の方々もいらっしゃるようで、どちらでも良さげに見えました。柔軟に、所属しているチームのスタイルガイドに従うと良いかな、と思っています。
Owner
Author
There was a problem hiding this comment.
@huyfififi
こちら随分とご返信遅くなってしまい申し訳ありません。
貴重なご意見ありがとうございます。
未経験+9ヶ月ほどしか書いてないので、実際の現場での感覚など非常にありがたいです。
都度reference確認しながら、所属するスタイルガイドに都度合わせられるように学習進めてみます。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This: https://leetcode.com/problems/reverse-linked-list/
Next: https://leetcode.com/problems/kth-largest-element-in-a-stream/description/