MCPcopy Create free account
hub / github.com/MisterBooo/LeetCodeAnimation / Solution

Class Solution

problems/0771-Jewels-Stones/Code/1.java:2–14  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1
2class Solution {
3 public int numJewelsInStones(String J, String S) {
4 Set<Character> Jset = new HashSet();
5 for (char j: J.toCharArray())
6 Jset.add(j);
7
8 int ans = 0;
9 for (char s: S.toCharArray())
10 if (Jset.contains(s))
11 ans++;
12 return ans;
13 }
14}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected