1、题目
https://leetcode-cn.com/problems/jewels-and-stones/
2、题意
题解1:
class Solution {
public:
int numJewelsInStones(string J, string S) {
int res = 0;
int hash[256] = {0};
for(int i=0;i<J.size();i++)
hash[J[i]] = 1;
for(int i=0;i<S.size();i++)
res+=hash[S[i]]==1?1:0;
return res;
}
};