Hash Tables: Ransom Note
字典的使用
python solution
1 | def checkMagazine(magazine, note): |
c++ solution
1 | void checkMagazine(vector<string> magazine, vector<string> note) { |
analysis
python solution
1 | def twoStrings(s1, s2): |
c++ solution
1 | string twoStrings(string s1, string s2) { |
analysis
- time complexity
O(n)
- space complexity
O(n)
Frequency Queries
需要兩組字典
python solution
1 | def freqQuery(queries): |
analysis
- time complexity
O(n)
- space complexity
O(n)