Home > Back-end >  The code which is wrong? Below is the topic, and then the execution results
The code which is wrong? Below is the topic, and then the execution results

Time:12-15

 char * longestCommonPrefix (char * * STRS, int strsSize) {
Char a, [10000]={0}.
Int j=1, z=0;
If (strsSize==0)
return "";
If (strsSize==1)
Return STRS [0].
for (int i=0; I While (STRS [j] [I] && STRS [1] [I]==STRS [j] [I]) {
J++;
}
If (j)==strsSize {
j=1;
A [z++]=STRS [0] [I];
}
The else
break;
}
A [z]='\ 0';
Return a;
}

  • Related