akshitagit / akshitagit/CPP

Median of two Sorted Arrays

未關閉
#158 5 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
algorithms C CPP good first issue hacktoberfest Hacktoberfest2020
主要語言
C++
星號
504
分支
436
PR 合併指標
30 天內沒有已合併 PR

描述

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.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。