problem
solution1:
class Solution {
public:
int numJewelsInStones(string J, string S) {
int res = ;
unordered_set<char> js(J.begin(), J.end());
for(auto ch:S)
{
if(js.find(ch)!=js.end()) res++;
}
return res;
}
};
参考
1. Leetcode_easy_771. Jewels and Stones;
2. Grandyang;
完