Skip to content

Commit 447c22a

Browse files
authored
Create Solution.cpp
1 parent a92e9da commit 447c22a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)