The test cases value of m and n is not sufficiently great to distinguish O(m+n) from O(log(m+n))

  • 1

    I submitted two solutions, one with O(m+n) complexity (merge the entire arrays first and then find the median), and one with O(log(m+n)) complexity (divide-and-conquer to find K smallest element of the two arrays and then calculate median) and latter was only 2ms faster. Suggest providing a test case that's sufficiently large to make the difference between logarithmic and linear runtime performance obvious.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.