MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / Solution

Class Solution

LeetCode_problems/Jewels and Stones/solution.cpp:1–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class Solution {
2public:
3 int numJewelsInStones(string J, string S) {
4 int count = 0; // taking the count of stones that are jewels
5 for(int i=0;i<J.size();i++){ // traversing over the types of jewels string
6 for(int j=0;j<S.size();j++){ // traversing over the type of stones given string and comparing if a jewel is present
7 if(J[i] == S[j]){
8 count++; // incrementing the count if jewel is found
9 }
10 }
11 }
12 return count;
13 }
14};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected