Why this is showing wrong ans in test case 1?
hello @abhi542136
for even(n+n= 2*n) lenght array median is defined as avergae of middle two numbers.
this is the issue in ur code, u r using incorrect fomula for computing median of even length array
still its not passing all test case… here is my updated code___
try this case->
10
1 5 6 12 13 14 15 16 17 18
2 3 4 7 8 9 10 11 19 20
expected is 10 , urs is giving 8.
also when u are accessing i+1 or j+1 then make sure the idex is valid
Okay, thanks… now I have fixed that… It is passing all test cases now…
cool…
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.