Re: [閒聊] 每日leetcode

作者: DJYOMIYAHINA (通通打死)   2025-10-16 08:20:46
好久沒有在早上寫了
先取餘數再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)
作者: zs111 (花椰菜怪物)   2025-10-16 09:19:00
今天請假嗎?

Links booklink

Contact Us: admin [ a t ] ucptt.com