What's your approach to "Median of Sorted Arrays"?

Problem: Median of Sorted Arrays
My [correct] solution: https://ide.codingblocks.com/s/41594

The constraints mentioned in question are very small.
You can simply apply the brute force, ie, save the sorted array and find its median

Or you can also find the median through just traversing the 2 sorted arrays, keeping count of the numbers traversed and the number of elements in the 2 arrays.

1 Like