-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57f7e46
commit ff91365
Showing
4 changed files
with
90 additions
and
43 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# | ||
# @lc app=leetcode.cn id=4 lang=python3 | ||
# | ||
# [4] 寻找两个有序数组的中位数 | ||
# | ||
# https://leetcode-cn.com/problems/median-of-two-sorted-arrays/description/ | ||
# | ||
# algorithms | ||
# Hard (37.27%) | ||
# Likes: 2822 | ||
# Dislikes: 0 | ||
# Total Accepted: 215.9K | ||
# Total Submissions: 563.6K | ||
# Testcase Example: '[1,3]\n[2]' | ||
# | ||
# 给定两个大小为 m 和 n 的正序(从小到大)数组 nums1 和 nums2。 | ||
# | ||
# 请你找出这两个正序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n))。 | ||
# | ||
# 你可以假设 nums1 和 nums2 不会同时为空。 | ||
# | ||
# | ||
# | ||
# 示例 1: | ||
# | ||
# nums1 = [1, 3] | ||
# nums2 = [2] | ||
# | ||
# 则中位数是 2.0 | ||
# | ||
# | ||
# 示例 2: | ||
# | ||
# nums1 = [1, 2] | ||
# nums2 = [3, 4] | ||
# | ||
# 则中位数是 (2 + 3)/2 = 2.5 | ||
# | ||
# | ||
# | ||
|
||
# @lc code=start | ||
class Solution: | ||
def findMedianSortedArrays(self, nums1: List[int], nums2: List[int]) -> float: | ||
# @lc code=end | ||
|
This file contains 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
This file contains 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