String:383. Ransom Note
来源:互联网 发布:股票计算器软件 编辑:程序博客网 时间:2024/06/05 16:22
我的常规方法:
class Solution {public: bool canConstruct(string ransomNote, string magazine) { map<char, int> m; for(int i = 0; i < magazine.size(); ++i) { m[magazine[i]]++; } for(int i = 0; i < ransomNote.size(); ++i) { if(m[ransomNote[i]] == 0) { return false; } else m[ransomNote[i]]--; } return true; }};没看到思路差很大的方法(我也没看几篇),就这样吧。
阅读全文
0 0
- String:383. Ransom Note
- Leetcode - String - 383. Ransom Note(水题)
- Leetcode- 383. Ransom Note(string)
- leetcode-383. Ransom Note
- [leetcode] 383. Ransom Note
- LeetCode 383. Ransom Note
- 383. Ransom Note*
- 383. Ransom Note
- leetcode 383. Ransom Note
- leetcode 383. Ransom Note
- 383. Ransom Note
- 383.[LeetCode]Ransom Note
- 383. Ransom Note
- 383. Ransom Note【E】
- leetcode 383. Ransom Note
- 383. Ransom Note
- 383. Ransom Note
- leetcode 383. Ransom Note
- PostgreSQL定时自动备份
- [js高手之路]深入浅出webpack教程系列6-插件使用之html-webpack-plugin配置(下)
- 单例模式学习
- 技术分享——mongodb入门(1)
- .net简单实现MVC模式
- String:383. Ransom Note
- Android GridView 设置间距不起作用
- 【Servlet】会话管理1
- 翻译连载 | JavaScript轻量级函数式编程-第7章: 闭包vs对象 |《你不知道的JS》姊妹篇
- IO操作
- STM32--F407看门狗(1)
- 杭电——find your present (2)
- Keras简单实现多层感知机(MLP)代码
- codevs1214 线段覆盖