码迷,mamicode.com
首页 > 其他好文 > 详细

【leetcode389】389. Find the Difference

时间:2017-04-14 00:16:56      阅读:119      评论:0      收藏:0      [点我收藏+]

标签:ring   ret   nbsp   div   turn   logs   har   span   bsp   

异或 找不同 —。—

 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 }

 

【leetcode389】389. Find the Difference

标签:ring   ret   nbsp   div   turn   logs   har   span   bsp   

原文地址:http://www.cnblogs.com/magicya/p/6706833.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!