Degree
Easy ★ (*´╰╯`๓)♬
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)).
Example1:
1 | nums1 = [1, 3] |
Example2:
1 | nums1 = [1, 2] |
Ideas
- 将两个数组合并成一个数组并按大小顺序排序
- 选取数组的中间两个数或一个数
- 算出平均数
Code
1 | /** |