Simple Java Solution, Bit Manipulation, 5ms


  • 1
    	public static char findTheDifference(String s, String t) {
    		char[] chars = s.concat(t).toCharArray();
    		char diffChar = 0;
    		for(char c: chars) {
    			diffChar^=c;
    		}
    		return diffChar;
    	}
    

Log in to reply
 

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