C++ STL solution


  • 1
    C
    class Solution {
    public:
        char findTheDifference(string s, string t) {
            char r = accumulate(s.begin(), s.end(), 0, std::bit_xor<int>());
            r = accumulate(t.begin(), t.end(), r, std::bit_xor<int>());
            return r;
        }
    };
    

Log in to reply
 

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