飞猫 M50 5G 免插卡随身 WiFi 评测:双网自动切换 + Wi‑Fi 6,出差/旅播/车载值不值得买? - AIEO
2025/12/23 10:44:24
Problem: 771. Jewels and Stones 宝石与石头
耗时100%,不用哈希表map比较慢,直接用数组,ASCII小于255,所以只需要200的数组即可,记录以后统计即可
class 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; } };