本文主要是介绍Amazon OA Building Roofs for Parking,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
def solu(nums, k):res = float('inf')nums.sort()temp = nums[:k]#print(temp)res = nums[k-1] - nums[0] + 1for i in range(k, len(nums)):temp.append(nums[i])temp = temp[1:]print(temp)res = min(res, temp[-1]-temp[0]+1)return resnums = [3,4,7,10]
k = 3
print(solu(nums, k))
这篇关于Amazon OA Building Roofs for Parking的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!