Create 39. Combination Sum.md#51
Open
fuga-98 wants to merge 1 commit into
Open
Conversation
oda
reviewed
May 23, 2025
|
|
||
| これは常識の範囲でしょうか。 | ||
|
|
||
| Discordで二件しか引っかからなかったので外れてそう。 |
There was a problem hiding this comment.
スターリングの公式は物理の人は知っています。
なお、計算量は分割数による評価が結構いいやつであると思います。これは常識の外でしょう。
https://discord.com/channels/1084280443945353267/1251052599294296114/1280322673855041587
ああ、なるほど。常識の外という表現は「知らなくてもどうということはなく、知っていても褒められない」ということを表しているのですね。
hroc135
reviewed
Jun 6, 2025
|
|
||
| こっちはほぼミスらない。 | ||
|
|
||
| 穴を下に掘る担当(added)と横に展開する担当(index+1)に仕事を渡すイメージ。 |
| sum_combinations = [[] for _ in range(target + 1) ] | ||
| sum_combinations[0].append([]) | ||
| for candidate in candidates: | ||
| for total in range(candidate, target + 1): |
There was a problem hiding this comment.
自分なら range(target - candidate + 1) にすると思いました。
nodchip
reviewed
Jun 6, 2025
| if total == target: | ||
| result.append(takeover_nums[:]) | ||
| break | ||
| next_stack.append([total,takeover_nums[:]]) |
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/combination-sum/description/