# 136. find median of two sorted array

JavaScriptAlgorithmIs this helpful ?

Share

from all members: - accepted / - tried

Given two sorted array of integers, please return the median.

```
median([1,2],[3,4,5])
// 3
```

If there are even numbers, return the average.

```
median([1,2],[3,4])
// 1.5
```

**follow-up**

What is the time & space cost of your approach? Could you do better?