I think this question is too easy. I wrote it in 5 mins. So, I think the difficulty of it may be easy, not Hard.
def findMedianSortedArrays(self, nums1, nums2):
:type nums1: List[int]
:type nums2: List[int]
sum_num = sorted(nums1 + nums2)
n = len(sum_num) / 2
if len(sum_num) % 2 == 0:
return (sum_num[n - 1] + sum_num[n]) / 2.0
- That's very hard to read. Please format it correctly.
- That's obviously not O(log(m+n)). So you indeed didn't do it right.
- That took you five minutes? Should take one, maybe two.
It brave of you to share your solution, thought it's not very satisfactory. But I still give you a up vote, don't feel disappointed for the down votes XD.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.