We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a92e9da commit 447c22aCopy full SHA for 447c22a
1 file changed
solution/0771.Jewels and Stones/Solution.cpp
@@ -0,0 +1,13 @@
1
+class Solution {
2
+public:
3
+ int numJewelsInStones(string J, string S) {
4
+ std::unordered_map<char,int> count;
5
+ int number = 0;
6
+ for(char c: J) count[c]++;
7
+ for(char c: S){
8
+ if(count.find(c)!=count.end())
9
+ number++;
10
+ }
11
+ return number;
12
13
+};
0 commit comments