【leetcode389】389. Find the Difference

异或 找不同 —。—

 1 public class Solution {
 2     public char findTheDifference(String s, String t) {
 3         char temp = 0x00;
 4         for(int i = 0;i < s.length();i++){
 5             temp =(char) (temp ^ s.charAt(i));
 6         }
 7         for(int i = 0;i < t.length();i++){
 8             temp =(char) (temp ^ t.charAt(i));
 9         }
10         return temp;
11     }
12 }
原文地址:https://www.cnblogs.com/magicya/p/6706833.html