public char findTheDifference(String s, String t) {
char ch =0;
for(int i=0; i<s.length(); i++) {
ch ^= s.charAt(i);
}
for(int i=0; i<t.length(); i++) {
ch ^= t.charAt(i);
}
return ch;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter