Median of sorted arrays

my code is working for sample input but not for test cases


Here is your corrected code. Median of any even sized array is at n/2 - 1.
Size of the final array is 2*n, So its median will be at n-1 index.