leetcode 389 Find the Difference C++
来源:互联网 发布:手机淘宝怎样实名认证 编辑:程序博客网 时间:2024/05/16 09:39
这个很简单,用了一个计数排序。
char findTheDifference(string s, string t) { vector<int> vec(26,0); for(int i = 0;i<s.size();i++){ vec[s[i]-'a']++; } for(int i = 0;i<t.size();i++){ if(vec[t[i]-'a'] != 0) vec[t[i]-'a']--; else return t[i]; } return 'a'; }
0 0
- 【LeetCode-389】Find the Difference(C++)
- LeetCode 389 Find the Difference
- Leetcode 389 Find the Difference
- Leetcode 389 Find the Difference
- LeetCode[389]Find the Difference
- LeetCode 389:Find the Difference
- Leetcode 389 Find the Difference
- [LeetCode-389]Find the Difference
- Leetcode 389 Find the Difference
- leetcode-389-find the difference
- leetcode 389 Find the Difference
- Leetcode #389 Find the Difference
- Leetcode 389 Find the Difference
- LeetCode.389 Find the Difference
- Leetcode:Find the Difference
- Find the Difference --LeetCode
- LeetCode Find the Difference
- [LeetCode] Find the Difference
- RGB详解系列
- 原子上下文,进程上下文,中断上下文的详细解析
- 深入理解Gradle
- 使用animator实现粒子动画效果
- c语言练习题——基础2
- leetcode 389 Find the Difference C++
- 类方法
- 微信公众号开发---机器人
- 指南第一章 例题4 UVALive 3708 Graveyard(参考系)
- POJ 1584 A Round Peg in a Ground Hole (判断凸多边形模板)
- python检测192.168.13.0/24网段的ssh存活主机
- HTTP协议详解
- c语言练习题——基础3
- Android Merge标签