299. Bulls and Cows 自己写已ac
来源:互联网 发布:爱奇艺万能播放器mac版 编辑:程序博客网 时间:2024/05/23 01:27
class Solution {public: string getHint(string secret, string guess) { map<char,int> mp; if(secret.size()==0)return ""; int a=0,b=0; string ss; for(int i=0;i<secret.size();i++){ if(secret[i]==guess[i]){ a++; } else { mp[secret[i]]++; ss+=guess[i]; } } for(int i=0;i<ss.size();i++){ if(mp[ss[i]]>0){ b++; mp[ss[i]]--; } } return to_string(a)+"A"+to_string(b)+"B"; }};
阅读全文
0 0
- 299. Bulls and Cows 自己写已ac
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- 299. Bulls and Cows
- Activity之间数据相互传递
- Automapper安装报错
- 谈谈页面流程图
- mybatis配置文件中#、$区别
- SQLYog快捷键大全
- 299. Bulls and Cows 自己写已ac
- 平衡二叉树
- C#操作JSON(组合,解析)
- tensorflow
- Why OM2 Multimode Fiber Has More Fiber Loss Than OM1?
- Java NIO系列教程(四) Scatter/Gather
- 深入剖析某国外组织针对中国境内企业的APT攻击(CVE-2015-8651)
- Struts文件上传
- Makefile详解