Median of two sorted arrays

https://ide.codingblocks.com/#/s/14141 - this is the code for median of two sorted arrays
question link - https://hack.codingblocks.com/contests/c/452/422
1 test is failing
what is the problem??

Hi,your code is fine.But in the problem,median element of [1,2,3,4,5,6,7,8,9,10] is 5.That means we have to tell the median element.Not the median that would be (5+6)/2.Your code is doing good log(n) in finding the median,but you have to tell the median element.Merging two arrays will work and just find the middle element.
code for reference in case you need further help - https://ide.codingblocks.com/#/s/14144

1 Like

thank you, got it :slight_smile: