CPP icon indicating copy to clipboard operation
CPP copied to clipboard

Median of two Sorted Arrays

Open pranjalibajpai opened this issue 4 years ago • 5 comments

Given two sorted arrays A and B of sizes n, m respectively. Find the median of these two arrays in O(1) space i.e. find the median without actually merging the two arrays.

Input Format First line contains two integers - n, m Next two lines contain n and m integers respectively.

Output Format Single integer denoting the median of the given arrays.

Sample Input
3
4
1 3 6 
2 4 8 10
Sample Output
4

Explanation
Array - 1 2 3 4 6 8 10
Median - 4
Sample Input
4
4
1 3 6 9 
2 4 8 10
Sample Output
5

Explanation
Array - 1 2 3 4 6 8 9 10
Median - (4+6)/2 = 5

Add code in the Interview Questions repo.

pranjalibajpai avatar Sep 26 '20 06:09 pranjalibajpai

I want to try this.

d2Anubis avatar Sep 26 '20 07:09 d2Anubis

I would like to work on this.

Maitryee-Choudhary avatar Sep 26 '20 11:09 Maitryee-Choudhary

Can I work on this as a part of hacktober fest 2020. please assign .

hritikkhurana10sm avatar Sep 26 '20 16:09 hritikkhurana10sm

Hello @pranjalibajpai can you please assign this issue?

kothawade29 avatar Sep 26 '20 16:09 kothawade29

may I work on this issue pls.

piyush9311 avatar Sep 28 '20 16:09 piyush9311