【Leetcode_easy】771. Jewels and Stones

网友投稿 514 2022-11-01

【Leetcode_easy】771. Jewels and Stones

【Leetcode_easy】771. Jewels and Stones

problem

​​771. Jewels and Stones​​

solution1:

class Solution {public: int numJewelsInStones(string J, string S) { int res = 0; unordered_set js(J.begin(), J.end()); for(auto ch:S) { if(js.find(ch)!=js.end()) res++; } return res; }};

参考

1. ​​Leetcode_easy_771. Jewels and Stones​​;

2. ​​Grandyang​​;

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:SQLPad 一个Web应用程序,用于编写和运行SQL查询并可视化结果
下一篇:httpcat一个用于在命令行上构造原始HTTP请求的简单实用程序
相关文章

 发表评论

暂时没有评论,来抢沙发吧~