Hi all,
New challenge time. Like a ghost town last week, haha.
This week though, I've chosen a medium difficulty problem from the beginning of the problem pool, as some of the later questions can be a little annoying, and the early ones are more popular and have many more community submissions.
4. Median of Two Sorted Arrays - https://leetcode.com/problems/median-of-two-sorted-arrays/description/
How it works/Rules:
New challenge time. Like a ghost town last week, haha.
This week though, I've chosen a medium difficulty problem from the beginning of the problem pool, as some of the later questions can be a little annoying, and the early ones are more popular and have many more community submissions.
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:
Code:nums1 = [1, 3] nums2 = [2] The median is 2.0
Example 2:
Code:nums1 = [1, 2] nums2 = [3, 4] The median is (2 + 3)/2 = 2.5
How it works/Rules:
- We use the random question picker (sometimes), and all attempt it, one question a week.
- No cheating/looking at the editorial solution until your soln is accepted on leetcode, and you're convinced you can't get it any quicker.
- Language is up to you, this may help people appreciate other languages as well
- Only post your time taken, language, and percentage of submissions beaten at first. Use spoiler+php tags for your code.