695. Max Area of Island#18
Open
hemispherium wants to merge 1 commit into
Open
Conversation
nodchip
reviewed
Apr 11, 2026
| public: | ||
| int m, n; | ||
|
|
||
| void countArea(vector<vector<int>>& grid, int x, int y, int& val) { |
There was a problem hiding this comment.
関数名は UpperCamel で書くのをよく見かけます。この辺りはチームの平均的な書き方に合わせることをお勧めいたします。
参考までにスタイルガイドへのリンクを共有いたします。
https://google.github.io/styleguide/cppguide.html#Function_Names
Ordinarily, functions follow PascalCase: start with a capital letter and have a capital letter for each new word.
なお、このスタイルガイドは“唯一の正解”というわけではなく、数あるガイドラインの一つに過ぎません。チームによって重視される書き方や慣習も異なります。そのため、ご自身の中に基準を持ちつつも、最終的にはチームの一般的な書き方に合わせることをお勧めします。
| public: | ||
| int m, n; | ||
|
|
||
| void countArea(vector<vector<int>>& grid, int x, int y, int& val) { |
There was a problem hiding this comment.
val という変数名は、中にどのような値が格納されているのか想像しづらく感じました。 area はいかがでしょうか?
| public: | ||
| int m, n; | ||
|
|
||
| void countArea(vector<vector<int>>& grid, int x, int y, int& val) { |
There was a problem hiding this comment.
出力を引数で参照渡しするほか、戻り値で返すこともできると思います。この辺りはチームの平均的な書き方に合わせることをお勧めいたします。
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.
この問題:https://leetcode.com/problems/max-area-of-island/description/
次に解く問題:https://leetcode.com/problems/word-ladder/description/
(https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/description/ がpremium限定のためスキップ)