Last active
October 13, 2016 05:01
-
-
Save kartikkukreja/596d7ad51c315629adf8a5e2c91ceeaa to your computer and use it in GitHub Desktop.
median of two sorted arrays example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Input: | |
A = [1,3,5] | |
B = [4,7] | |
Output: | |
4 | |
Explanation: | |
The combined array is [1,3,4,5,7] and the middle element is 4. | |
Input: | |
A = [1,3,4,5] | |
B = [2,7] | |
Output: | |
3.5 | |
Explanation: | |
The combined array is [1,2,3,4,5,7]. | |
The two middle elements are 3 and 4 and their average is 3.5. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment