To find the median of two sorted arrays can be a tricky question. Remember not to confuse median with mean here. Median represents the middle value for any given range of values. So, given two sorted arrays, we would need to do a megre combine step for them, where we iterate over both arrays ( as in Merge sort combine step ) and store all the values in another array whose size is sum of sizes of two given arrays. Then we calculate the middle element of this new array and that would be the median. Time Complexity would be O(N) and space complexity would be O(n1+n2).