2026/5/21 13:31:13
网站建设
项目流程
推广做网站怎么样,谷歌广告联盟网站,地方门户网站带手机版,一个网站怎么做Problem: 771. Jewels and Stones 宝石与石头 解题过程 耗时100%#xff0c;不用哈希表map比较慢#xff0c;直接用数组#xff0c;ASCII小于255#xff0c;所以只需要200的数组即可#xff0c;记录以后统计即可 Code
class Solution {
public:bool ch[200];int numJewel…Problem: 771. Jewels and Stones 宝石与石头解题过程耗时100%不用哈希表map比较慢直接用数组ASCII小于255所以只需要200的数组即可记录以后统计即可Codeclass Solution { public: bool ch[200]; int numJewelsInStones(string jewels, string stones) { memset(ch, 0, sizeof(ch)); for(char c : jewels) { ch[(int)c] true; } int num 0; for(char c : stones) { if(ch[(int)c] true) { num; } } return num; } };