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. 简单ssh

    #!/usr/bin/env python #-*- coding:utf-8 -*- # datetime:2019/5/22 14:20 # software: PyCharm #服务端 impo ...

  2. Activiti学习记录(三)

    1.流程变量 1.1 流程图 流程变量在整个工作流中扮演很重要的作用.例如:请假流程中有请假天数.请假原因等一些参数都为流程变量的范围.流程变量的作用域范围是只对应一个流程实例.也就是说各个流程实例的 ...

  3. 深入浅出:了解JavaScript的六种继承

    了解继承前我们需要了解函数的构造,方便我们理解. 常见六种继承方式: 1.原型继承call和apply: 2.原型拷贝:循环父函数protype的key值=子函数prototype的key值: 3.原 ...

  4. nodejs 实现图片上传

    1.首先在目录下的运行cmd,执行以下命令 npm install multer; 2.在router下新建upload.js let express = require('express');let ...

  5. 十七、MySQL UNION 操作符

    MySQL UNION 操作符 本教程为大家介绍 MySQL UNION 操作符的语法和实例. 描述 MySQL UNION 操作符用于连接两个以上的 SELECT 语句的结果组合到一个结果集合中.多 ...

  6. Vue -computed传参数

    vue 中computed想传递参数怎么办? 闭包在这里起到的重要的作用 <input v-model="newItem(key,val)" type="text& ...

  7. node.js express环境下中文需要注意的地方

    问题一: 最近在nuxt项目中开始着手把一些跨域的请求转移到express里,其实跟其他语言差不多,http对象发请求,接收请求都写得很顺畅.之前用的请求部分大多数是get请求,所以除了注意编码问题之 ...

  8. 为什么选择Redis

    1)Redis不仅仅支持简单的k/v类型的数据,同时还提供list,set,zset,hash等数据结构的存储.    2)Redis支持master-slave(主-从)模式应用    3)Redi ...

  9. centos7.3网络配置

    一.关闭NetworkManager 默认状态下最小化安装使用NetworkManager这个服务来控制联网的,但是这个配置在配置生产环境服务器时一般不会使用,而是使用系统自带的network服务,更 ...

  10. 7、python中的字典

    字典是python内置的一种无序.可变的数据结构. 字典也叫哈希表.什么是哈希表?哈希表就是会对表中的键(key)执行哈希计算,并根据计算结果在内存中分配一个区域来储存该键所对应的值(value).这 ...