Skip to content

213. House Robber II#49

Open
colorbox wants to merge 1 commit into
mainfrom
213
Open

213. House Robber II#49
colorbox wants to merge 1 commit into
mainfrom
213

Conversation

@colorbox
Copy link
Copy Markdown
Owner

Comment thread 213/step3.cpp
}

private:
int rob_linear(std::span<int>& nums) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

spanは元々lightweight viewなので&は必要ないかと思います

Comment thread 213/step1.cpp
return max(nums[0], nums[1]);
}

vector<int>maxRobbedMoneyWithFirstRobbed(nums.size(), 0);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

> のあとにスペースを空けるほうが多いと思います。

Comment thread 213/step3.cpp
}
int robbed_2_previous_max_money = nums[0];
int robbed_previous_max_money = nums[1];
for(int i = 2; i < nums.size(); ++i) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

if for のあとにスペースが空いているものと空いていないものとが混ざっているのが気になりました。空けるほうに統一するとよいと思います。

参考までにスタイルガイドへのリンクを共有いたします。

https://google.github.io/styleguide/cppguide.html#Horizontal_Whitespace

if (b) { // Space after the keyword in conditions and loops.

なお、このスタイルガイドは“唯一の正解”というわけではなく、数あるガイドラインの一つに過ぎません。チームによって重視される書き方や慣習も異なります。そのため、ご自身の中に基準を持ちつつも、最終的にはチームの一般的な書き方に合わせることをお勧めします。

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