Median of Two Sorted Arrays

Hard
Arrays Binary Search
Find the median of two sorted arrays in O(log(m+n)). Input: two lines of space-separated sorted numbers Output: median

Constraints

See problem-specific constraints. Optimized solution required.

Examples

Example 1:
Input: 1 3 2
Output:
Example 2:
Input: 1 3 2
Output:

Hints

Consider a binary search approach.
Think about time complexity.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.