6ms JAVA XOR operator solution


  • 0

    my 6ms code

    char bit = 0;
    	    char[] s1 = s.toCharArray();
    	    char[] t1 = t.toCharArray();
    	    
    	    for(int i = 0; i<s.length(); i++){
    	    	bit ^= s1[i];
    	    	bit ^= t1[i];
    	    }
    	    bit ^= t1[t.length()-1];
    	    return bit;
    
    

Log in to reply
 

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