C - Add chars


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

Log in to reply
 

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