You will be given a list of integers, , and a single integer . You must create an array of length from elements of such that its unfairness is minimized. Call that array . Unfairness of an array is calculated as
Where:
- max denotes the largest integer in
- min denotes the smallest integer in
Answers
Answered by
0
Answer:
vsh-enmh-cmh come all allowe
Answered by
2
Answer:
Problem:
Problem:Given a list of N integers, your task is to select K integers from the list such that its unfairness is minimized.
Problem:Given a list of N integers, your task is to select K integers from the list such that its unfairness is minimized.Unfairness = Max{K integer Set} - Min{K integer Set}
- Problem:Given a list of N integers, your task is to select K integers from the list such that its unfairness is minimized.Unfairness = Max{K integer Set} - Min{K integer Set}where max denotes the largest integer among the elements of K, and min denotes the smallest integer among the elements of K.
Input Format :
- The first line contains an integer N.
- The second line contains an integer K.
- N lines follow. Each line contains an integer that belongs to the list N.
Note: Integers in the list N may not be unique.
output format:
An integer that denotes the minimum possible value of unfairness.
Constraints:
2≤N≤105
2≤K≤N
0≤integer inN≤109
Explanation:
thank you❤
Similar questions