My 3ms C++ method easy to understand


  • 0
    S

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

    }

Log in to reply
 

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