| 1 | class Solution { |
| 2 | public int numJewelsInStones(String jewels, String stones) { |
| 3 | // Calculating frequency |
| 4 | int charFreq[] = new int[256]; |
| 5 | for(int i=0;i<stones.length();i++) |
| 6 | { |
| 7 | charFreq[stones.charAt(i)-65]++; |
| 8 | } |
| 9 | |
| 10 | // for storing result |
| 11 | int count=0; |
| 12 | |
| 13 | for(int i=0;i<jewels.length();i++) |
| 14 | { |
| 15 | count+=charFreq[jewels.charAt(i)-65]; |
| 16 | } |
| 17 | return count; |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | |
| 22 |
nothing calls this directly
no outgoing calls
no test coverage detected