Timeline
Timeline
2025-11-13
init
Hash table
Problem:
Hash table record
12345678910111213141516171819202122232425 | using std::string;using std::unordered_map;class Solution { public: bool canConstruct(string ransomNote, string magazine) { unordered_map<char, int> uset; for (auto &ch : magazine) uset[ch]++; for (auto &ch : ransomNote) { if (!uset.count(ch)) return false; if (uset[ch] == 0) return false; uset[ch]--; } return true; }}; |
