当前位置:网站首页>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)边栏推荐
- Hang wait lock vs spin lock (where both are used)
- 剑指 Offer 58 - II. 左旋转字符串
- Sword finger offer 35 Replication of complex linked list
- Sword finger offer 53 - ii Missing numbers from 0 to n-1
- On the characteristics of technology entrepreneurs from Dijkstra's Turing Award speech
- 个人开发的渗透测试工具Satania v1.2更新
- Daily question - longest substring without repeated characters
- Chapter 6 data flow modeling - after class exercises
- CF1637E Best Pair
- Detailed explanation of expression (csp-j 2021 expr) topic
猜你喜欢

全国中职网络安全B模块之国赛题远程代码执行渗透测试 //PHPstudy的后门漏洞分析

游戏商城毕业设计

SAP-修改系统表数据的方法

用STM32点个灯

SAP method of modifying system table data

CF1634 F. Fibonacci Additions

Graduation project of game mall

剑指 Offer 05. 替换空格

Typical use cases for knapsacks, queues, and stacks

On the characteristics of technology entrepreneurs from Dijkstra's Turing Award speech
随机推荐
[practical skills] technical management of managers with non-technical background
个人开发的渗透测试工具Satania v1.2更新
Acwing 4300. Two operations
The number of enclaves
卷积神经网络——卷积层
After setting up the database and website When you open the app for testing, it shows that the server is being maintained
Educational codeforces round 109 (rated for Div. 2) C. robot collisions D. armchairs
注解与反射
Transform optimization problems into decision-making problems
API related to TCP connection
Bit mask of bit operation
On-off and on-off of quality system construction
On the characteristics of technology entrepreneurs from Dijkstra's Turing Award speech
In this indifferent world, light crying
kubeadm系列-01-preflight究竟有多少check
Common optimization methods
全国中职网络安全B模块之国赛题远程代码执行渗透测试 //PHPstudy的后门漏洞分析
网络工程师考核的一些常见的问题:WLAN、BGP、交换机
Codeforces Round #732 (Div. 2) D. AquaMoon and Chess
Solution to game 10 of the personal field