看板 Marginalman 關於我們 聯絡資訊
好久沒有在早上寫了 先取餘數再count 然後看看哪個餘數的count最小 坑就會在那邊 找到那個坑即可 def findSmallestInteger(self, nums: List[int], value: int) -> int: res_cnt = [0]*value for num in nums: res_cnt[num%value] += 1 def argmin(a): # will return leftmost if equal return min(range(len(a)), key=lambda x : a[x]) return argmin(res_cnt)+value*min(res_cnt) -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.132.58.28 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1760574048.A.72D.html
zs111: 今天請假嗎? 10/16 09:19
DJYOMIYAHINA: 比較早起床 10/16 13:44