class Solution {
public:
int numJewelsInStones(string J, string S) {
unordered_set<char> set;
for (auto j: J) set.insert(j);
int count = 0;
for (auto s: S){
if (set.find(s) != set.end()) count++;
}
return count;
}
};
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.