当前位置:网站首页>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)
边栏推荐
- Remote upgrade afraid of cutting beard? Explain FOTA safety upgrade in detail
- “磐云杯”中职网络安全技能大赛A模块新题
- 常见的最优化方法
- Haut OJ 1401: praise energy
- Introduction to convolutional neural network
- 全国中职网络安全B模块之国赛题远程代码执行渗透测试 //PHPstudy的后门漏洞分析
- Simple knapsack, queue and stack with deque
- Sword finger offer 09 Implementing queues with two stacks
- On-off and on-off of quality system construction
- [practical skills] technical management of managers with non-technical background
猜你喜欢
Brief introduction to tcp/ip protocol stack
Little known skills of Task Manager
CF1637E Best Pair
剑指 Offer 53 - II. 0~n-1中缺失的数字
Solution to game 10 of the personal field
Sword finger offer 53 - ii Missing numbers from 0 to n-1
Sword finger offer 05 Replace spaces
Corridor and bridge distribution (csp-s-2021-t1) popular problem solution
游戏商城毕业设计
CF1634 F. Fibonacci Additions
随机推荐
2022年贵州省职业院校技能大赛中职组网络安全赛项规程
每日一题-搜索二维矩阵ps二维数组的查找
Analysis of backdoor vulnerability in remote code execution penetration test / / phpstudy of national game title of national secondary vocational network security B module
Alu logic operation unit
Haut OJ 2021 freshmen week II reflection summary
挂起等待锁 vs 自旋锁(两者的使用场合)
The connection and solution between the shortest Hamilton path and the traveling salesman problem
用STM32点个灯
Talking about JVM (frequent interview)
Sword finger offer 04 Search in two-dimensional array
High precision subtraction
【Jailhouse 文章】Performance measurements for hypervisors on embedded ARM processors
Mysql database (I)
Introduction and experience of wazuh open source host security solution
Detailed explanation of expression (csp-j 2021 expr) topic
After setting up the database and website When you open the app for testing, it shows that the server is being maintained
6. Logistic model
SAP-修改系统表数据的方法
卷积神经网络——卷积层
How many checks does kubedm series-01-preflight have