作者DJYOMIYAHINA (通通打死)
看板Marginalman
標題Re: [閒聊] 每日leetcode
時間Thu Sep 12 08:36:22 2024
好像也沒什麼特別做法
早早早早早
一二三四五
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
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.229.37.69 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1726101384.A.64A.html
→ sustainer123: 早早早 09/12 08:43
→ JerryChungYC: 早早早 09/12 08:50