Skip to content

add: Coin Change#16

Open
rossy0213 wants to merge 1 commit intomainfrom
arai60-41
Open

add: Coin Change#16
rossy0213 wants to merge 1 commit intomainfrom
arai60-41

Conversation

@rossy0213
Copy link
Copy Markdown
Owner

@rossy0213 rossy0213 commented May 21, 2024

int[] dp = new int[amount + 1];

for (int i = 1; i <= amount; i++) {
dp[i] = 10001;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

意味のありそうなマジックナンバーは避けたほうがいいです。仕様は変わります。

dp はわりと意味のない変数名なので、もうちょっと意味があるものを付けたほうがいいでしょう。
https://discord.com/channels/1084280443945353267/1231966485610758196/1236231890038689844

Comment on lines +63 to +65
if (dp[amount] > amount) {
return -1;
}
Copy link
Copy Markdown

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.

3 participants