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