Jewels and Stones LeetCode solution in C++

1
class Solution {
2
public:
3
map<char, int> umap;
4
int numJewelsInStones(string J, string S) {
5
for (char c : S) {
6
umap[c]++;
7
}
8
int count = 0;
9
for (char c : J) {
10
if (umap.count(c)) {
11
count += umap[c];
12
}
13
}
14
return count;
15
}
16
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0