class Solution {
public:
int numJewelsInStones(string J, string S) {
unordered_set<char> s;
int res=0;
for(auto i:J)
s.insert(i);
for(auto i:S) {
if(s.count(i))
res++;
}
return res;
}
};
Leetcode771(力扣771):宝石与石头
最新推荐文章于 2024-07-25 19:34:38 发布