leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0383.cpp (284B)


0 class Solution {
1 public:
2 bool canConstruct(string ransomNote, string magazine) {
3 unordered_map<char, int> us;
5 for (char c : magazine)
6 us[c]++;
8 for (char c : ransomNote)
9 if (!us[c]--) return false;
11 return true;
12 }
13 };