作者DJYOMIYAHINA (通通打死)
看板Marginalman
標題Re: [閒聊] 每日leetcode
時間Mon Jul 21 21:57:10 2025
https://iili.io/FNAUGZF.png
不懂為何如此離群
普通人應該都這樣寫吧
def makeFancyString(self, s: str) -> str:
pre_ch, times = "", 1
rets = ""
for c in s:
if c==pre_ch:
if times==2:
continue
else:
times+=1
else:
pre_ch=c
times=1
rets += c
return rets
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.132.58.28 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1753106233.A.2A1.html
※ 編輯: DJYOMIYAHINA (220.132.58.28 臺灣), 07/21/2025 21:57:22
推 osopopototo: 大師 07/21 22:01