C easy xor O(n)


  • 0
    V
    char findTheDifference(char * s, char * t) 
    {
        int result = *t++;
        
        while (*s)
    		result ^= *s++ ^ *t++;
    		
    	return result;
    }
    

Log in to reply
 

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