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)


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