Skip to content

209. Minimum Size Subarray Sum#49

Open
dxxsxsxkx wants to merge 1 commit into3_longest_substring_without_repeating_charactersfrom
209_minimum_size_subarray_sum
Open

209. Minimum Size Subarray Sum#49
dxxsxsxkx wants to merge 1 commit into3_longest_substring_without_repeating_charactersfrom
209_minimum_size_subarray_sum

Conversation

@dxxsxsxkx
Copy link
Copy Markdown
Owner

int remaining = prefix_sum[right + 1] - target;

// Largest `left` where prefix_sum[left] <= remaining
auto it = std::upper_bound(prefix_sum.begin(), prefix_sum.end(), remaining);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

right以降を探して大丈夫かな、と一瞬気になりました(numsが正なので累積和も単調増加する。したがって探しても見つからない)。

@mamo3gr
Copy link
Copy Markdown

mamo3gr commented Mar 22, 2026

全体的に読みやすかったです 👍

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.

2 participants