一开始没看见shuffle...觉得同时遍历不就完事了。。

和那个所有数字出现2,有一个出现3次还是什么的一样,CHAR可以完美和INT相互切换。

public class Solution
{
public char findTheDifference(String s, String t)
{ int res = 0; for(int i = 0; i < s.length();i++)
{
res ^= s.charAt(i);
}
for(int i = 0; i < t.length();i++)
{
res ^= t.charAt(i);
} return (char)res;
}
}

389. Find the Difference的更多相关文章

  1. LeetCode 389. Find the Difference

    Given two strings s and t which consist of only lowercase letters. String t is generated by random s ...

  2. LeetCode之389. Find the Difference

    -------------------------------------------------- 先计算每个字母的出现次数然后减去,最后剩下的那一个就是后来添加的了. AC代码: public c ...

  3. 【LeetCode】389 Find the Difference(java)

    原题 Given two strings s and t which consist of only lowercase letters. String t is generated by rando ...

  4. 9. leetcode 389. Find the Difference

    Given two strings s and t which consist of only lowercase letters. String t is generated by random s ...

  5. LeetCode 389 Find the Difference 解题报告

    题目要求 Given two strings s and t which consist of only lowercase letters. String t is generated by ran ...

  6. [LeetCode&Python] Problem 389. Find the Difference

    Given two strings s and t which consist of only lowercase letters. String t is generated by random s ...

  7. LeetCode - 389. Find the Difference - 三种不同解法 - ( C++ ) - 解题报告

    1.题目大意 Given two strings s and t which consist of only lowercase letters. String t is generated by r ...

  8. 389. Find the Difference 找出两个字符串中多余的一个字符

    [抄题]: Given two strings s and t which consist of only lowercase letters. String t is generated by ra ...

  9. *389. Find the Difference (string + map(26)) read problems carefully

    Given two strings s and t which consist of only lowercase letters. String t is generated by random s ...

随机推荐

  1. createjs 下雪 实例

    demo:  http://output.jsbin.com/davixatona <!DOCTYPE html> <html> <head> <meta c ...

  2. js 组件的写法

    var Test1 = function(){ var name = ""; this.setName = function(username){ name = username; ...

  3. Setup FTP Server On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3

    setsebool allow_ftpd_full_access onsetsebool -P ftp_home_dir on vsftpd (Very Secure File Transport P ...

  4. php 目录及文件操作

    // bool is_dir(string $filename) 判断给定文件名是否是一个目录.// resource opendir(string $path[,resource $context] ...

  5. C#如何释放已经加载的图片 (转)

    使用Image.FromFile取磁盘上的图片时,这个方法会锁定图片文件,而且会导致内存占用增大, 有几种方法解决: 一:将Image类转换成Bitmap类 System.Drawing.Image ...

  6. css3学习--css3动画详解二(3d效果)

    一.设置3D场景 perspective:800       //浏览器到物体的距离(像素)perspective-origin:50% (x轴) 50% (y轴)    //视点的位置 transf ...

  7. Mysql JDBC Url参数说明useUnicode=true&characterEncoding=UTF-8

    MySQL的 JDBC URL 格式 for  Connector/J 如下例: jdbc:mysql://[host][,failoverhost...][:port]/[database] » [ ...

  8. 练习2 J题 - 多项式求和

      Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   Description 多项式 ...

  9. 源码编译基于Android平台的XBMC笔记

    参考官方网站:https://github.com/xbmc/xbmc/blob/master/docs/README.android   1. 编译主机系统 Ubuntu (12.04) 64Bit ...

  10. DBA - 我的学习

    DBA - 我的学习 1. df -k 检查oracle 分区硬盘使用情况 2. 检查alert_<SID名称>.log, alert日志文件,检查是否新增错误日志 3. 检查数据文件的状 ...