18/180: Median of Two sorted array of different Size [Hard Prolem] [LeetCode]
Today is day 18 of my 180 day’s challenge, long way to complete the challenge, but all in good shape hope to complete this challenge.
Good thing about today is I managed to wake up 4:30 and it’s already 6:30 and still not able to conclude the solution for this, even after watching many videos related to this problem, it’s a bit tricky one. But I am surely gonna do it today and will explain this in the blog.
Let’s begin with the problem:
First what is median of one sorted array. It is the mid point of the array if number is odd, if even then it (a[mid] + a[mid+1])/2. So how can we find a median of two sorted arrays.
Brute Force approach
We can merge the two sorted arrays and then can find the median by finding the mid point. But it’s not an optimized approach.