class Solution {
public:
char findTheDifference(string s, string t) {
map<char,int> mp;
for(int i=0;i<s.length();i++){
mp[s[i]]++;
}
char ans;
for(int i=0;i<t.length();i++){
if(mp[t[i]]>0) mp[t[i]]--;
else{
ans=t[i];
break;
}
}
return ans;
}
};
08-07
65
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交