C++ 4ms XOR,simple


  • 1
    B

    class Solution {
    public:
    char findTheDifference(string s, string t) {
    char dif = 0x00;
    for(int i = 0 ;i <s.length();i++)
    dif ^=s.at(i);
    for(int j = 0 ; j<t.length();j++)
    dif ^=t.at(j);
    return dif;
    }
    };


Log in to reply
 

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