
Re: [閒聊] 每日leetcode

不懂為何如此離群
普通人應該都這樣寫吧
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
推
07/21 22:01,
4月前
, 1F
07/21 22:01, 1F
討論串 (同標題文章)
完整討論串 (本文為第 1475 之 1554 篇):