# My code is Last executed input: [], [1]，but I think it is not problem

• public class Solution {
public double findMedianSortedArrays(int A[], int B[]) {

``````   int lengtha=A.length;
int lengb=B.length;
if(lengtha+lengb==0)return 0;
if(lengb==0)
{
if(lengtha%2!=0)return A[lengtha/2];
else return (A[lengtha/2]+A[lengtha/2+1])/2;
}
if(lengtha==0)
{
if(lengb%2!=0)return B[lengb/2];
else return (B[lengb/2]+B[lengb/2+1])/2;
}
double ok=0;int q1=0,q2=0;

int[] qw=new int[lengb+lengtha];
int z=A[0];
int x=B[0];
for(int p=0;p<lengb+lengtha;p++)
{
if(z<=x)
{
qw[p]=z;
//System.out.println(qw[p]);
if(q1==lengtha-1){z=Integer.MAX_VALUE;x=B[q2];}
else
{
q1++;
z=A[q1];
x=B[q2];
}
}
else
{
qw[p]=x;
//System.out.println(qw[p]);
if(q2==lengb-1){x=Integer.MAX_VALUE;z=A[q1];}
else{
q2++;
z=A[q1];
x=A[q2];}
}
}
if((lengb+lengtha)%2==0)
{
ok=(qw[(lengb+lengtha)/2]+A[(lengb+lengtha)/2-1])/2;
}
if((lengb+lengtha)%2!=0)
{
// System.out.println("ok");
ok=qw[(lengb+lengtha)/2];
}

return ok;
}
``````

}

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