3 line C++ solution by bit manipulation


  • 0
    P
    char findTheDifference(string s, string t) {
            char c = 0;
            for(auto x : s + t) c ^= x;
            return c;
        }
    

Log in to reply
 

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