7711 [LeetCode] 771, Jewels and Stones Skill Use hash table to decrease time complexity to under log(n^2) Others Use string struct member Use ASCII Number of english letter int gstHashTable[60] = { 0 }; class Solution { public: int numJewelsInStones(string jewels, string stones) { memset(&gstHashTable, 0, sizeof(int) * 60); int RetVal = 0; for (int i = 0; i != stones.size(); ++i) { gstHashTable[stones[i] - 65]++; } for (int i = 0; i .. 2023. 2. 14. 이전 1 다음