389. Find the Difference
一开始没看见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的更多相关文章
- LeetCode 389. Find the Difference
Given two strings s and t which consist of only lowercase letters. String t is generated by random s ...
- LeetCode之389. Find the Difference
-------------------------------------------------- 先计算每个字母的出现次数然后减去,最后剩下的那一个就是后来添加的了. AC代码: public c ...
- 【LeetCode】389 Find the Difference(java)
原题 Given two strings s and t which consist of only lowercase letters. String t is generated by rando ...
- 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 ...
- LeetCode 389 Find the Difference 解题报告
题目要求 Given two strings s and t which consist of only lowercase letters. String t is generated by ran ...
- [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 ...
- 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 ...
- 389. Find the Difference 找出两个字符串中多余的一个字符
[抄题]: Given two strings s and t which consist of only lowercase letters. String t is generated by ra ...
- *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 ...
随机推荐
- LINQ 101——分组、Set、转换、Element
一.Grouping(分组) 例1:对于0-9数按被3整除的结果分组 代码: static void Linq1() { , , , , , , , , , }; var numModBy3 = fr ...
- 不同的路径 II
class Solution { public: /** * @param obstacleGrid: A list of lists of integers * @return: An intege ...
- transcode_step()在转码过程中对pts、dts、duration的处理
对pts.dts.duration的处理主要集中在两大函数里面 1.process_input()读入数据并处理,放到滤镜里面 2.reap_filters()从滤镜读出数据,处理后写入文件 proc ...
- JQuery 字符串截取
//字符串截取,全小写 strObj.substring(startIndex,endIndex); //需要注意大小写 strObj.lastIndexOf(String splitObj); // ...
- iOS: 学习笔记实例, 用代码控制视图创建与切换
1. 创建iOS, Single View Application.2. 修改YYViewController.m // // YYViewController.m // DynamicViewDem ...
- VisualSVN Server 从此告别SVN记事本配置
http://www.visualsvn.com/downloads/ 注意下载的是Server版本,他还会提供一个visual Studio的插件: 安装完毕后,可以在管理界面进行角色添加,创建 ...
- 构建微服务:Spring boot
构建微服务:Spring boot 在上篇文章构建微服务:Spring boot 提高篇中简单介绍了一下spring data jpa的基础性使用,这篇文章将更加全面的介绍spring data jp ...
- 10个WordPress增强型编辑器大检阅
Wordpress之所以优秀不在于其本身,而在于无数的插件开发者和性能优化人员.使用过Wordpress的人都知道,WP本身的编辑器极其简陋,就连简单的表格编辑也没有,可能吧这篇文章将介绍一些免费的增 ...
- Two shortest
sgu185:http://acm.sgu.ru/problem.php?contest=0&problem=185 题意:找两条最短路径,没有边相交的最短路劲,并且输出路径. 题解:这一题和 ...
- Dictionary Size
uvaLive5913:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&pag ...