LeetCode-4:Median of Two Sorted Arrays

一、題目

原題鏈接:https://leetcode.com/problems/median-of-two-sorted-arrays/description/
難度等級:困難

There are two sorted arrays nums1 and nums2 of size m and n respectively.

Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).

Example 1:

nums1 = [1, 3]
nums2 = [2]
The median is 2.0

Example 2:

nums1 = [1, 2]
nums2 = [3, 4]

The median is (2 + 3)/2 = 2.5

題目翻譯:
有兩個大小爲 m 和 n 的排序數組 nums1 和 nums2 。

請找出兩個排序數組的中位數並且總的運行時間複雜度爲 O(log (m+n))


二、解題方案

(待完善。。。)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章