Skip to content

Commit 28127ef

Browse files
committed
leetcode_771
1 parent 989ab9f commit 28127ef

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

771_Jewels_and_Stones.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public:
3+
int numJewelsInStones(string jewels, string stones) {
4+
int ret{};
5+
unordered_map<char, int> umj;
6+
for(const char& c : jewels)
7+
umj[c]++;
8+
for(const char& c : stones)
9+
ret+=umj[c];
10+
return ret;
11+
}
12+
};

0 commit comments

Comments
 (0)