1class Solution {2 public:3 map<char, int> umap;4 int numJewelsInStones(string J, string S) {5 for (char c : S) {6 umap[c]++;7 }8 int count = 0;9 for (char c : J) {10 if (umap.count(c)) {11 count += umap[c];12 }13 }14 return count;15 }16};
WPM •0 •0
ACC •0 •0
TIME •0