class Solution {
public:
char findTheDifference(string s, string t) {
map<char,int>Map_Temp;
for(int i=;i<s.size();i++)
Map_Temp[s[i]-'a']++;
for(int i=;i<t.size();i++)
Map_Temp[t[i]-'a']--;
map<char,int>::iterator iter;
for(iter=Map_Temp.begin();iter!=Map_Temp.end();iter++)
if(iter->second)
return char(iter->first+'a');
return ;
}
};

leetcode 389 map iterator 的使用的更多相关文章

  1. Java容器类Collection,List,Set,Map.,Iterator,Collections工具类,Arrays工具类,Comparable

    Java容器类Collection,List,Set,Map.,Iterator,Collections工具类,Arrays工具类,Comparable接口,泛型 Collection,List,Se ...

  2. [LeetCode] 900. RLE Iterator RLE迭代器

    Write an iterator that iterates through a run-length encoded sequence. The iterator is initialized b ...

  3. [LeetCode] 281. Zigzag Iterator 之字形迭代器

    Given two 1d vectors, implement an iterator to return their elements alternately. Example: Input: v1 ...

  4. [LeetCode] 284. Peeking Iterator 瞥一眼迭代器

    Given an Iterator class interface with methods: next() and hasNext(), design and implement a Peeking ...

  5. [LeetCode#281] Zigzag Iterator

    Problem: Given two 1d vectors, implement an iterator to return their elements alternately. For examp ...

  6. LeetCode 389——找不同

    1. 题目 2. 解答 2.1. 方法一 将 s 和 t 转化为 Python 的列表,然后遍历列表 s 的元素,将它们从列表 t 中删除,最后列表 t 中会余下一个元素,即为所求. class So ...

  7. leetcode 900. RLE Iterator

    Write an iterator that iterates through a run-length encoded sequence. The iterator is initialized b ...

  8. leetcode 349 map

    只需要用map来标记1,今儿通过map的值来得到重叠的部分 class Solution { public: vector<int> intersection(vector<int& ...

  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 ...

随机推荐

  1. @TransactionConfiguration过时与替代写法

    在使用了Spring的项目中做单元测试时,以前的标准写法是这样的: 但是在高版本的Spring框架中(Spring4.2以后),@TransactionConfiguration已经标注为过时的注解, ...

  2. JDBC 基本语法总结

    实现JDBC操作: 静态SQL执行 ① 注册驱动 Class.forName("com.mysql.jdbc.Driver"); ② 创建连接 Connection con = D ...

  3. windows下sorl安装

    1. JDK要求 Solr 4.10 要求JDK版本必须是1.7或更高. 2. 下载 下载地址: http://www.apache.org/dyn/closer.cgi/lucene/solr/ 下 ...

  4. 关于多行文本 textarea 在ios 真机上padding相对安卓较大问题

    问题: 多行文本组件是带有默认的padding的,然而,小程序的teatarea 在ios和安卓上显示的padding不一样,普遍ios的padding会比安卓的要明显的大.这种情况下我的想法是做兼容 ...

  5. oc字典

    #import <Foundation/Foundation.h> int main(int argc, const char * argv[]) { @autoreleasepool { ...

  6. 多页应用 Webpack4 配置优化与踩坑记录

    前言 最近新起了一个多页项目,之前都未使用 webpack4 ,于是准备上手实践一下.这篇文章主要就是一些配置介绍,对于正准备使用 webpack4 的同学,可以做一些参考. webpack4 相比之 ...

  7. PHP 计算代码运行所占内存和时间

    PHP 计算代码运行所占内存和时间 在PHP开发过程中,写出高质量的代码是很重要的,除了代码必须规范之外,性能也是不可忽视的一方面,那么如果检验一段代码是否高效呢,可通过以下一段php代码来粗略检测 ...

  8. php扩展开发-实现一个简易的哈希表

    从一个简易的哈希表入手,会让你更好的理解php的哈希表,他们的本质是一样的,只是php的哈希表做了更多的功能扩展,php的哈希表是php语言的一个重要核心,大量的内核代码使用到哈希表. #includ ...

  9. 面试前赶紧看了5道Python Web面试题,Python面试题No17

    目录 本面试题题库,由公号:非本科程序员 整理发布 第1题: Flask中的请求上下文和应用上下文是什么? 第2题:django中间件的使用? 第3题: django开发中数据做过什么优化? 第4题: ...

  10. 自定义token,保存到客户端的cookie中,

    自定义token #原理自定义token,放入cookie中,不用存数据库 #token定义方式 >>>>> "加密字符串"|登陆用户id|用户登陆时 ...