simple c 0ms solution,just a little work


  • 2
    I

    char findTheDifference(char* s, char* t) {
    int i=0,j=0;
    int sum1=0,sum2=0;
    char result;
    while(s[i])
    {
    sum1+=s[i];
    i++;
    }
    while(t[j])
    {
    sum2+=t[j];
    j++;
    }
    result=(char)(sum2-sum1);
    return result;
    }


Log in to reply
 

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