首页 > 其他 > 详细

383. 赎金信

时间:2020-04-27 15:21:01      阅读:50      评论:0      收藏:0      [点我收藏+]
 1 class Solution 
 2 {
 3 public:
 4     bool canConstruct(string ransomNote, string magazine) 
 5     {
 6         unordered_map<char,int> hash_r,hash_m;
 7         for(auto a : magazine) hash_m[a] ++;
 8         for(auto a : ransomNote) hash_r[a] ++;
 9         for(auto a : hash_r)
10         {
11             if(a.second > hash_m[a.first]) return false;
12         }
13         return true;
14     }
15 };

 

383. 赎金信

原文:https://www.cnblogs.com/yuhong1103/p/12786454.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!