Re: [闲聊] 每日leetcode

楼主: DJYOMIYAHINA (通通打死)   2024-09-12 08:36:22
好像也没什么特别做法
早早早早早
一二三四五
def countConsistentStrings(self, allowed: str, words: List[str]) -> int:
allowed_set = set(c for c in allowed)
ans = 0
for w in words:
ans += 1
for c in w:
if c not in allowed_set:
ans -= 1
break
return ans
作者: sustainer123 (caster)   2024-09-12 08:43:00
早早早
作者: JerryChungYC (JerryChung)   2024-09-12 08:50:00
早早早

Links booklink

Contact Us: admin [ a t ] ucptt.com