作者DJYOSHITAKA (franchouchouISBEST)
標題Re: [閒聊] 每日leetcode
時間2024-06-01 08:59:26
3110. Score of a String
這題好暖 我流淚了
昨天娜題 什麼鬼==
周末由窩心的題目開始
def scoreOfString(self, s: str) -> int:
pre = ord(s[0])
ans = 0
for i in range(1, len(s)):
ans += abs(ord(s[i])-pre)
pre = ord(s[i])
return ans
--
※ 發信站: 批踢踢實業坊(ptt-website.tw), 來自: 125.228.146.144 (臺灣)
※ 文章網址: https://ptt-website.tw/Marginalman/M.1717203568.A.A04
推 sustainer123: 確實 前幾週假日都hard 有夠白痴 06/01 09:00
推 an94mod0: 大師 06/01 09:01
→ rainkaras: 大師 請問一下新手用C#刷可以ㄇ 還是要學java或用C++ 06/01 09:01
→ rainkaras: 啊 我看解答用C#的好少 06/01 09:01
→ sustainer123: 可以ㄅ 二跑就用C#刷 06/01 09:01
推 riokio: 覺得包養網EY嗎 06/01 09:01 → sixB: 為什麼不用睡覺這麼早起來 今天週末欸我哭了 06/01 09:17
→ sixB: c#有4個加欸 有時候會看到一些神奇功能 06/01 09:19
推 SecondRun: 演算法用什麼都差不多吧 06/01 09:59
→ SecondRun: 可能就少一些語法糖要多寫幾行的事 06/01 10:00