104. Median of Two Lists
Hard
Given the sorted lists a and b, return the median of all their elements. If the total number of elements is even, the median is the average of the two middle values.
Example 1
Input: a = [1,3], b = [2]
Output: 2
Example 2
Input: a = [1,2], b = [3,4]
Output: 2.5
Constraints
- 0 <= a.length, b.length <= 10000
- a e b estão em ordem não decrescente
- A soma dos tamanhos é pelo menos 1
Binary searchArrays
Saved in this browser
Caso 1
a =
[1,3]
b =
[2]
Expected =
2
Caso 2
a =
[1,2]
b =
[3,4]
Expected =
2.5
Run checks these 2 cases. Submit runs all 8, including hidden ones.