C solution - find missing char


  • 0
    S
    #define xor ^
    #define null '\0'
    #define not !=
    char findTheDifference(char* s, char* t) {
        int i = 0, answer = 0;
        while(s[i] not null){
            answer = answer xor s[i];
            i++;
        }
        i = 0;
        while(t[i] not null){
            answer = answer xor t[i];
            i++;
        }
        return answer;
    }
    

Log in to reply
 

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