Re: [閒聊] 每日leetcode
只有綠色可以給我救贖了
唉 一二三四五
def numWaterBottles(self, numBottles: int, numExchange: int) -> int:
rets, residual = 0, 0
while numBottles>0:
rets += numBottles
numBottles, residual = (numBottles+residual)//numExchange, (
numBottles+residual)%numExchange
return rets
昨天的
原本想說可以想一個什麼解析解
但還是硬幹了 對ㄚ
def triangularSum(self, nums: List[int]) -> int:
n = len(nums)
for i in range(n, 0, -1):
for j in range(i-1):
nums[j] = (nums[j]+nums[j+1])%10
return nums[0]
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.132.58.28 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1759332331.A.24F.html
→
10/01 23:27,
2月前
, 1F
10/01 23:27, 1F
→
10/01 23:27,
2月前
, 2F
10/01 23:27, 2F
→
10/01 23:30,
2月前
, 3F
10/01 23:30, 3F
推
10/01 23:33,
2月前
, 4F
10/01 23:33, 4F
討論串 (同標題文章)
完整討論串 (本文為第 1528 之 1548 篇):