异或 找不同 —。—
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 }
时间: 2024-10-12 22:28:56