Solution to Median of Two Sorted Arrays by LeetCode

25 Mar

Question: http://oj.leetcode.com/problems/median-of-two-sorted-arrays/

Question Name: Median of Two Sorted Arrays

This question is quite similar with the nu2011 (DoubleMedian) by Codility. Both of them are the variants of the question: find the kth smallest element in two sorted array.

BTW: LeetCode’ online judge system is much worse than that from Codility. The problem description did not indicate the data type, whether int or double. In addition, what should we do if they are two empty array? What’s worse, the online judge system is quite unstable. The completely same solution gets two different results: one “Timeout” and one “Accepted”.

Leave a Reply

Your email address will not be published. Required fields are marked *

Please put your code into a <pre>YOUR CODE</pre> section. Thanks and Happy Coding!