当前位置:网站首页>Daily question 1984 Minimum difference in student scores
Daily question 1984 Minimum difference in student scores
2022-07-05 05:42:00 【A big pigeon】
topic :
To give you one Subscript from 0 Start Array of integers for nums , among nums[i] It means the first one i A student's grade . I'll give you another integer k .
Select any... From the array k A student's grade , Make this k Between scores The highest and Lowest score Of Difference value achieve To minimize the .
Return possible Minimum difference
Explain :
class Solution:
def minimumDifference(self, nums: List[int], k: int) -> int:
nums.sort()
cc = [nums[i+k-1]-nums[i] for i in range(len(nums)-k+1)]
return min(cc)边栏推荐
- YOLOv5-Shufflenetv2
- R语言【数据集的导入导出】
- lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
- Cluster script of data warehouse project
- Full Permutation Code (recursive writing)
- Time of process
- Alu logic operation unit
- Typical use cases for knapsacks, queues, and stacks
- 【Jailhouse 文章】Performance measurements for hypervisors on embedded ARM processors
- Add level control and logger level control of Solon logging plug-in
猜你喜欢
![[practical skills] how to do a good job in technical training?](/img/a3/7a1564cd9eb564abfd716fef08a9e7.jpg)
[practical skills] how to do a good job in technical training?
![[practical skills] technical management of managers with non-technical background](/img/4d/1081c71df6ee2087359111baf7498a.png)
[practical skills] technical management of managers with non-technical background

从Dijkstra的图灵奖演讲论科技创业者特点

【实战技能】非技术背景经理的技术管理

【Jailhouse 文章】Jailhouse Hypervisor

shared_ Repeated release heap object of PTR hidden danger

全排列的代码 (递归写法)

【云原生】微服务之Feign自定义配置的记录

Talking about JVM (frequent interview)

The connection and solution between the shortest Hamilton path and the traveling salesman problem
随机推荐
全国中职网络安全B模块之国赛题远程代码执行渗透测试 //PHPstudy的后门漏洞分析
Sword finger offer 53 - I. find the number I in the sorted array
Warning using room database: schema export directory is not provided to the annotation processor so we cannot export
Light a light with stm32
软件测试 -- 0 序
Brief introduction to tcp/ip protocol stack
On-off and on-off of quality system construction
Educational codeforces round 109 (rated for Div. 2) C. robot collisions D. armchairs
Educational Codeforces Round 116 (Rated for Div. 2) E. Arena
2022 极术通讯-Arm 虚拟硬件加速物联网软件开发
On the characteristics of technology entrepreneurs from Dijkstra's Turing Award speech
Daily question - longest substring without repeated characters
Convolution neural network -- convolution layer
Pointnet++ learning
[jailhouse article] jailhouse hypervisor
Individual game 12
2017 USP Try-outs C. Coprimes
Daily question - Search two-dimensional matrix PS two-dimensional array search
Web APIs DOM node
sync.Mutex源码解读