Simply by find the difference


  • 0
    S
        char findTheDifference(string s, string t) {
            int k = 0;
            for (int i = 0; i < s.size(); i++) {
                k += t[i];
                k -= s[i];
            }
            k += t.back();
            return k;
        }
    

Log in to reply
 

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