码迷,mamicode.com
首页 > 其他好文 > 详细

leetcode 389 map iterator 的使用

时间:2016-09-29 21:12:38      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:

 1 class Solution {
 2 public:
 3     char findTheDifference(string s, string t) {
 4         map<char,int>Map_Temp;
 5         for(int i=0;i<s.size();i++)
 6         Map_Temp[s[i]-a]++;
 7         for(int i=0;i<t.size();i++)
 8         Map_Temp[t[i]-a]--;
 9         map<char,int>::iterator iter;
10         for(iter=Map_Temp.begin();iter!=Map_Temp.end();iter++)
11         if(iter->second)
12         return char(iter->first+a);
13         return 0;
14     }
15 };

 

leetcode 389 map iterator 的使用

标签:

原文地址:http://www.cnblogs.com/thefirstfeeling/p/5920901.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!