Skip to content

Instantly share code, notes, and snippets.

@1nsunym
1nsunym / 771.cpp
Created March 31, 2018 06:03
LeetCode problem solutions: 771. Jewels and Stones
class Solution {
public:
int numJewelsInStones(string J, string S) {
bool isJewel[500] = {false, };
int jewelCount = 0;
for (int i = 0; i < J.length(); i++) {
isJewel[J[i]] = true;
}
for (int i = 0; i < S.length(); i++) {
jewelCount += int(isJewel[S[i]]);