力扣1984. 学生分数的最小差值

class Solution(object):
    def minimumDifference(self, A, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: int
        """
        n = len(A)
        if n <= 1: return 0
        A.sort()
        # print A
        ans = 10**5
        for i in range(n-k+1):
            # print i, A[i]
            ans = min(ans, A[i+k-1]-A[i])
        for j in range(n-1, k-1, -1):
            # print j, A[j]
            ans = min(ans, A[j]-A[j-k+1])
        return ans

============ 关注我们获取更多就业求职教育解题相关信息 ============

YouTubeTwitterFacebookTikTokInstagram西瓜视频1西瓜视频2哔哩哔哩1哔哩哔哩2CSDN简书百家号企鹅号快手1快手2知乎1知乎2搜狐视频好看视频豆瓣1豆瓣2小红书1小红书2

CSDN: https://blog.csdn.net/weixin_63044430?spm=1010.2135.3001.5343
知乎1: https://www.zhihu.com/people/zyx-93-83/zvideos
知乎2: https://www.zhihu.com/people/49-38-77-61-35/zvideos
简书: https://www.jianshu.com/u/cfced7c674af 
西瓜视频1: https://www.ixigua.com/home/5843340996?list_entrance=studio&wid_try=1
西瓜视频2: https://www.ixigua.com/home/1635680166351767?list_entrance=studio&wid_try=1
哔哩哔哩1:  https://space.bilibili.com/649661852
哔哩哔哩2: https://space.bilibili.com/1924307045
百家号: https://author.baidu.com/home?context=%7B"uk"%3A"gwgdi7wwHjLdUhWhLZ_sJw"%7D
企鹅号: https://media.om.qq.com/author?id=MeLRdnnZ7sVGrh6uR6MwXPGg0
快手1: https://www.kuaishou.com/profile/3xsshqc8ftwwchy
快手2: https://www.kuaishou.com/profile/3xznzpw8uarf23c
搜狐视频: https://tv.sohu.com/user/398416206#t0
好看视频: https://haokan.baidu.com/author/1749087353945237
豆瓣1:https://www.douban.com/people/220149171/?_i=8275562lEWOkUe
豆瓣2:  https://www.douban.com/people/264323900/?_i=8275667-gEBisQ
小红书1:https://www.xiaohongshu.com/user/profile/633d7b25000000001802f02c
小红书2: https://www.xiaohongshu.com/user/profile/6038a744000000000100bfc0
YouTube: https://www.youtube.com/channel/UCGIflgWZUv4UKt0aycR5_tA
Twitter: https://twitter.com/JackZho83306286
Facebook:https://www.facebook.com/profile.php?id=100087279621454
TikTok: https://www.tiktok.com/@seascience2022
Instagram: https://www.instagram.com/seascience2022/


[YouTube](https://www.youtube.com/channel/UCGIflgWZUv4UKt0aycR5_tA)

[Twitter](https://twitter.com/JackZho83306286)

[Facebook](https://www.facebook.com/profile.php?id=100087279621454)

[TikTok](https://www.tiktok.com/@seascience2022)

[Instagram]( https://www.instagram.com/seascience2022/)

[西瓜视频1](https://www.ixigua.com/home/5843340996?list_entrance=studio&wid_try=1)

[西瓜视频2](https://www.ixigua.com/home/1635680166351767?list_entrance=studio&wid_try=1)

[哔哩哔哩1](https://space.bilibili.com/649661852)

[哔哩哔哩2](https://space.bilibili.com/1924307045)

[CSDN](https://blog.csdn.net/weixin_63044430?spm=1010.2135.3001.5343)

[简书](https://www.jianshu.com/u/cfced7c674af)

[百家号](https://author.baidu.com/home?context=%7B"uk"%3A"gwgdi7wwHjLdUhWhLZ_sJw"%7D)

[企鹅号](https://media.om.qq.com/author?id=MeLRdnnZ7sVGrh6uR6MwXPGg0)

[快手1](https://www.kuaishou.com/profile/3xsshqc8ftwwchy)

[快手2](https://www.kuaishou.com/profile/3xznzpw8uarf23c)

[知乎1](https://www.zhihu.com/people/zyx-93-83/zvideos)

[知乎2](https://www.zhihu.com/people/49-38-77-61-35/zvideos)

[搜狐视频](https://tv.sohu.com/user/398416206#t0)

[好看视频](https://haokan.baidu.com/author/1749087353945237)

[豆瓣1](https://www.douban.com/people/220149171/?_i=8275562lEWOkUe)

[豆瓣2](https://www.douban.com/people/264323900/?_i=8275667-gEBisQ)

[小红书1](https://www.xiaohongshu.com/user/profile/633d7b25000000001802f02c)

[小红书2](https://www.xiaohongshu.com/user/profile/6038a744000000000100bfc0)

```

CSDN: https://blog.csdn.net/weixin_63044430?spm=1010.2135.3001.5343

知乎1: https://www.zhihu.com/people/zyx-93-83/zvideos

知乎2: https://www.zhihu.com/people/49-38-77-61-35/zvideos

简书: https://www.jianshu.com/u/cfced7c674af 

西瓜视频1: https://www.ixigua.com/home/5843340996?list_entrance=studio&wid_try=1

西瓜视频2: https://www.ixigua.com/home/1635680166351767?list_entrance=studio&wid_try=1

哔哩哔哩1:  https://space.bilibili.com/649661852

哔哩哔哩2: https://space.bilibili.com/1924307045

百家号: https://author.baidu.com/home?context=%7B"uk"%3A"gwgdi7wwHjLdUhWhLZ_sJw"%7D

企鹅号: https://media.om.qq.com/author?id=MeLRdnnZ7sVGrh6uR6MwXPGg0

快手1: https://www.kuaishou.com/profile/3xsshqc8ftwwchy

快手2: https://www.kuaishou.com/profile/3xznzpw8uarf23c

搜狐视频: https://tv.sohu.com/user/398416206#t0

好看视频: https://haokan.baidu.com/author/1749087353945237

豆瓣1:https://www.douban.com/people/220149171/?_i=8275562lEWOkUe

豆瓣2:  https://www.douban.com/people/264323900/?_i=8275667-gEBisQ

小红书1:https://www.xiaohongshu.com/user/profile/633d7b25000000001802f02c

小红书2: https://www.xiaohongshu.com/user/profile/6038a744000000000100bfc0

YouTube: https://www.youtube.com/channel/UCGIflgWZUv4UKt0aycR5_tA

Twitter: https://twitter.com/JackZho83306286

Facebook:https://www.facebook.com/profile.php?id=100087279621454

TikTok: https://www.tiktok.com/@seascience2022

Instagram: https://www.instagram.com/seascience2022/

```

LeetCode 全解 文章被收录于专栏

LeetCode 全解持续更新;点题超过一定人数优先更新解答;还能更近一步接受手把手讲解

全部评论

相关推荐

Pandaileee:校友加油我现在也只有一个保底太难了
点赞 评论 收藏
分享
ArisRobert:统一解释一下,第4点的意思是,公司按需通知员工,没被通知到的员工是没法去上班的,所以只要没被通知到,就自动离职。就是一种比较抽象的裁员。
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务