Skip to content

【Grind75Hard】12問目 4. Median of Two Sorted Arrays#71

Open
shining-ai wants to merge 1 commit intomainfrom
grind75_12
Open

【Grind75Hard】12問目 4. Median of Two Sorted Arrays#71
shining-ai wants to merge 1 commit intomainfrom
grind75_12

Conversation

@shining-ai
Copy link
Copy Markdown
Owner

middle_2 = len(nums2) // 2
if middle_1 + middle_2 < k:
if nums1[middle_1] < nums2[middle_2]:
return get_kth_small(k - middle_1 - 1, nums1[middle_1 + 1 :], nums2)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

これはここでスライスを取っているからコピーされていませんか。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

level1のようにindexで管理したほうが良さそうですね。
引数減らせて読みやすいかと思いましたが、遅くなるデメリットのほうが大きいですね。

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