Re: [閒聊] 每日leetcode

作者: DJYOMIYAHINA (通通打死)   2025-01-13 23:29:03
哀 剩我老老實實一個個判斷式慢慢判斷了
def minimumLength(self, s: str) -> int:
cnt = [0 for _ in range(26)]
for c in s:
cnt[ord(c)-ord('a')] += 1
ans = 0
for a in cnt:
if a>0 and a%2==0:
ans += 2
elif a>0 and a%2==1:
ans += 1
return ans
作者: b77889999 (逼機)   2025-01-13 23:32:00
別卷了
作者: oin1104 (是oin的說)   2025-01-13 23:35:00
我哭了 大師
作者: Meaverzt (Meaverzt)   2025-01-13 23:39:00
大師

Links booklink

Contact Us: admin [ a t ] ucptt.com