C 0ms simple solution


  • 1
    M
    char findTheDifference(char* s, char* t) {
        int a = 0, b = 0;
        int i=0, j=0;
        while (s[i])
        {
            a ^= s[i];
            b ^= t[i];
            i++;
        }
        b ^= t[i];
        return a^b;
    }
    

Log in to reply
 

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