Leetcode 383 Ransom Note
来源:互联网 发布:网络抓包软件 编辑:程序博客网 时间:2024/05/17 23:13
Leetcode 383 Ransom Note
#include <string>#include <vector>using namespace std;class Solution {public: bool canConstruct(string ransomNote, string magazine) { vector <int> ransomNoteFreq(26);//统计词频 vector <int> magazineFreq(26); for (int i = 0; i < ransomNote.size(); i++){ ransomNoteFreq[ransomNote[i] - 'a']++; } for (int i = 0; i <magazine.size(); i++){ magazineFreq[magazine[i] - 'a']++; } for (int i = 0; i < ransomNoteFreq.size(); i++){ if (ransomNoteFreq[i] > magazineFreq[i]) return false; } return true; }};
阅读全文
0 0
- LeetCode:383 Ransom Note
- LeetCode#383 Ransom Note
- LeetCode 383 Ransom Note
- LeetCode 383:Ransom Note
- Leetcode 383 Ransom Note
- leetcode-383-Ransom Note
- leetcode 383 Ransom Note
- Leetcode #383 Ransom Note
- Leetcode 383 Ransom Note
- LeetCode 383 Ransom Note
- LeetCode[383] Ransom Note
- LeetCode--No.383--Ransom Note
- leetcode 383 Ransom Note C++
- LeetCode(383)Ransom Note
- 【LeetCode-383】Ransom Note(C++)
- [LeetCode-383]Ransom Note(java)
- 【LeetCode】383 Ransom Note(java)
- LeetCode 383:Ransom Note (c++)
- Java记录 -26- StringPool和字面赋值
- Java记录 -27- String的intern方法
- Java记录 -28- String Literals字面值
- Java记录 -29- StringBuffer
- Java记录 -30- 包装类
- Leetcode 383 Ransom Note
- Java记录 -31- Java数组
- Java记录 -32- 值交换
- Java IO读写大文件的几种方式及测试
- Hadoop之父Doug Cutting
- TPS和QPS
- Java记录 -33- 数组存放对象地址
- Java记录 -34- Arrays类解析
- Java记录 -35- System类解析