This problem can be converted to the problem of finding kth element, k is (A's length + B' Length)/2.
If any of the two arrays is empty, then the kth element is the non-empty array's kth element. If k == 0, the kth element is the first element of A or B.
For normal cases(all other cases), we need to move the pointer at the pace of half of the array size to get O(log(n)) time.
The main challenge is to calculate the middle elements, we can not do the following like a regular binary search:
int m1 = i1+(j1-i1)/2;
int m2 = i2+(j2-i2)/2;
It will result in either dead loop or missing the element at the beginning. The key is we always drop <= half size of the elements.