The solution is very lengthy whereas I have done it with a very simple method. Please let me know if my approach is wrong, https://ide.codingblocks.com/s/362987
Median of sorted arrays!
hello @yashjain0112
ur approach is correct .
but ur formula need bit modification.
it should be (a[n-1]+a[n])/2
Sorry, didn’t understand what you said. I haven’t used any formula. Simply took 2n numbers in one array only instead of 2 arrays and sorted the whole array using the sort function. Then printed the middle value.
yeah , actually i m talking about mid value.
here u have two mid values right? n-1 and n
thats why u need to print average of those two middle value
1 Like
Ohh, got it!
Thanks for helping me out!