3 line Java solution 5ms


  • 0
    C
    public char findTheDifference(String s, String t) {
        char xor = 0;
        for(char c : (s+t).toCharArray()) xor ^= c;            
        return xor;
    }
    

Log in to reply
 

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