389. Find the Difference
2016-08-30 11:04
169 查看
class Solution { public: char findTheDifference(string s, string t) { /*vector<int> count(26,0); for(int i=0;i<s.size();i++) count[s[i]-'a']++; for(int i=0;i<t.size();i++) count[t[i]-'a']--; for(int i=0;i<count.size();i++) if(count[i]==-1) return i+'a'; return ' ';*/ char ch=0; for(int i=0;i<s.length();i++) ch^=s[i]; for(int i=0;i<t.length();i++) ch^=t[i]; return ch; } };
相关文章推荐
- [LeetCode]389. Find the Difference
- leetcode - 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389.Find the Difference
- 389. Find the Difference | 找字符串中的不同
- [leetcode]389. Find the Difference -- JavaScript 代码
- 【Leetcode】389. Find the Difference
- LeetCode 389:Find the Difference
- 389. Find the Difference --字符串的共同字符
- LeetCode - 389. Find the Difference
- LeetCode 389. Find the Difference
- 389. Find the Difference-hash map/XOR
- leetcode-389-find the difference
- leetcode 389. Find the Difference
- LeetCode-389. Find the Difference (Java)
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference
- 389. Find the Difference