首页 > 技术文章 > leetcode771

asenyang 2018-09-27 11:49 原文

int numJewelsInStones(string J, string S) {
    set<char> st;
    int count = 0;
    for (auto c : J)
    {
        st.insert(c);
    }
    for (auto s : S)
    {
        if (st.find(s) != st.end())
        {
            count++;
        }
    }
    return count;
}

 

推荐阅读