Skip to content

Insert Interval - #76

Open
Yuto729 wants to merge 2 commits into
mainfrom
insert-interval
Open

Insert Interval#76
Yuto729 wants to merge 2 commits into
mainfrom
insert-interval

Conversation

@Yuto729

@Yuto729 Yuto729 commented Jun 1, 2026

Copy link
Copy Markdown
Owner

解く問題

Insert Interval

次に解く問題

01 Matrix

Comment thread insert-interval/main.md

result = []
# idx = startがnewInterval[0]以下の最も右の区間のインデックス
idx = bisect_right(intervals, newInterval[0], key=lambda x: x[0]) - 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.

こちらのコメントをご参照ください。
hemispherium/LeetCode_Arai60#10 (comment)

Comment thread insert-interval/main.md
new_intervals = intervals + [newInterval]
new_intervals.sort()
merged_intervals = []
for i in range(len(new_intervals)):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

for new_interval in new_intervals:

のほうがシンプルになると思いました。

@nodchip

nodchip commented Jun 3, 2026

Copy link
Copy Markdown

0 <= intervals.length <= 1012 の場合について考えると勉強になると思いました。

Repository owner deleted a comment from github-actions Bot Jun 16, 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