problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::minimum_difference_between_highest_and_lowest_of_k_scores::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static int minimumDifference (vector< int > &nums, int k)
 

详细描述

在文件 leetcode.h1058 行定义.

成员函数说明

◆ minimumDifference()

int leetcode::minimum_difference_between_highest_and_lowest_of_k_scores::Solution::minimumDifference ( vector< int > &  nums,
int  k 
)
static

在文件 leetcode.cpp2665 行定义.

2665 {
2666 int ans = 100000;
2667 sort(nums.begin(), nums.end());
2668 for(int i = 0; i + k - 1 < nums.size(); i++) {
2669 ans = min(ans, nums[i + k - 1] - nums[i]);
2670 }
2671 return ans;
2672 }

被这些函数引用 leetcode::minimum_difference_between_highest_and_lowest_of_k_scores::TEST().


该类的文档由以下文件生成: