Skip to content

112. Path Sum#24

Open
hemispherium wants to merge 1 commit into
mainfrom
0112-path-sum
Open

112. Path Sum#24
hemispherium wants to merge 1 commit into
mainfrom
0112-path-sum

Conversation

@hemispherium
Copy link
Copy Markdown
Owner

@hemispherium hemispherium self-assigned this Apr 16, 2026
Comment thread 0112-path-sum/step1.cpp
*/
class Solution {
public:
int flag = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

こちらのコメントをご参照ください。
5ky7/arai60#22 (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.

ご指摘ありがとうございます!こちらに関しては全く意識していなかったので勉強になりました。

Comment thread 0112-path-sum/step1.cpp
return;
}
if (root->left == nullptr && root->right == nullptr) {
flag = flag || (sum == targetSum);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

flag |= (sum == targetSum);

のほうがシンプルだと思いました。

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.

ありがとうございます。そうですね、そちらの方がシンプルそうです。

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