4 Lines 4ms C++ solution


  • 0
    char findTheDifference(string s, string t) {
            int res = 0;
            for(int i=0; i<s.length(); ++i)
                res ^= s[i] ^ t[i];
            return res ^ t[t.length()-1];
        }
    

Log in to reply
 

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