Could someone tell me if there's a better way of doing this? I was asked this question in an interview and I wrote a piece of code of O(n2).
// This function returns a new string of the common alphabets found in a and b
char* intersection(char*a, char* b)
static char temp;
int i = 0;
if ( (a==NULL) || (b==NULL))
while ( a != NULL)
temp[i] = *a;