位操作-leetcode 389 Find the Difference

来源:互联网 发布:sql如何查询字段长度 编辑:程序博客网 时间:2024/06/05 14:59

原题链接:Find the Difference


题解:

class Solution {public:    char findTheDifference(string s, string t) {        /*            Time Complexity:O(m+n)            Space Complexity:O(1)        */        char r=0;        for(auto &c:s)r^=c;        for(auto &c:t)r^=c;        return r;    }};