0ms O(n) C solution


  • 0
    S
    char findTheDifference(char* s, char* t) {
        int sum=0;
        while(*s != '\0' ){
            sum+=(*t-*s);
            s++;
            t++;
        }
        sum+=*t;
        return (char)sum;
           
    }
    

Log in to reply
 

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