Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/shuuji3/leetcode. 📃 Code submitted to LeetCode leetcode.com/shuuji3
Something went wrong. Try again.
Note of Problem #4 #
Solution #
I read Median of Two Sorted Arrays - LeetCode but do not understand fully how to find the boundary between the right and left parts with a binary search.
If I'm given the boundary, I was able to come up with the formula to calculate the median same as the description.
My answer #
My answer took the different approach. It's not efficient as much as the solution but more readable one. At first I make a new sorted list concatenating both lists. And just find the median using the list.
I think the space complexity is $O(m+n)$ for a new list and the time complexity is $O(m+n)$. Both complexity is more than the optimal solution but more readable.