Median of two Sorted Arrays
- Lingua principale
- C++
- Stelle
- 504
- Fork
- 436
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.