Skip to content

Create 39. Combination Sum.md#51

Open
fuga-98 wants to merge 1 commit into
mainfrom
39.-Combination-Sum
Open

Create 39. Combination Sum.md#51
fuga-98 wants to merge 1 commit into
mainfrom
39.-Combination-Sum

Conversation

@fuga-98
Copy link
Copy Markdown
Owner

@fuga-98 fuga-98 commented May 23, 2025

Comment thread 39. Combination Sum.md

これは常識の範囲でしょうか。

Discordで二件しか引っかからなかったので外れてそう。
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

スターリングの公式は物理の人は知っています。

なお、計算量は分割数による評価が結構いいやつであると思います。これは常識の外でしょう。
https://discord.com/channels/1084280443945353267/1251052599294296114/1280322673855041587

ああ、なるほど。常識の外という表現は「知らなくてもどうということはなく、知っていても褒められない」ということを表しているのですね。

Comment thread 39. Combination Sum.md

こっちはほぼミスらない。

穴を下に掘る担当(added)と横に展開する担当(index+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.

同じイメージです。

Comment thread 39. Combination Sum.md
sum_combinations = [[] for _ in range(target + 1) ]
sum_combinations[0].append([])
for candidate in candidates:
for total in range(candidate, target + 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.

自分なら range(target - candidate + 1) にすると思いました。

Comment thread 39. Combination Sum.md
if total == target:
result.append(takeover_nums[:])
break
next_stack.append([total,takeover_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.

, のあとにスペースを空けることをお勧めします。

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.

4 participants