char * longestCommonPrefix(char ** strs, int strsSize){
char ch;
int len=0, i, j;
if (strsSize < 1) {return "";}
len = strlen(strs[0]);
for (i=1; i<strsSize; ++i) {
len = len < strlen(strs[i]) ? len : strlen(strs[i]);
}
for (i=0; i<len; i++) {
ch = strs[0][i];
for (j=1; j<strsSize; ++j) {
if (ch != strs[j][i]) break;
}
if (j != strsSize) {
break;
}
}
char *res = malloc (len+1);
memset(res, 0, len+1);
memcpy(res, strs[0], i);
return res;
}