C++ using sum difference


  • 1
        char findTheDifference(string s, string t) {
            int a = 0;
            int b = 0;
            for (char c : s)
                a += c;
            for (char c : t)
                b += c;
                
            return b - a;
        }
    

Log in to reply
 

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