LETCODE 771

class Solution {
public:
int numJewelsInStones(string J, string S) {
map<char, int> tem;
int count = 0;
for (auto i = S.begin(); i != S.end(); i++)
{
tem[*i]++;
}
for (auto j = J.begin(); j != J.end(); j++)
{
count += tem[*j];
}
return count;
}
};

发布了9 篇原创文章 · 获赞 0 · 访问量 130

猜你喜欢

转载自blog.csdn.net/qq_40742888/article/details/98386877
771
今日推荐