NPTEL |The Joy of computing using Python | WEEK 11| Programming Assignment-1 Marks distribution

Published: 05 October 2019
on channel: Ultimate Gamer
3,662
17

Given a list A of n elements, representing the marks. There are m students and you have to distribute the marks from the list A to m students such that:

1) Each student gets marks.
2) The difference between the maximum marks and minimum marks given to the students is minimised.

Input Format:
The first line contains the value n and m respectively separated by a space.
The second line contains the elements of list A separated by a space

Output Format:
Print the minimum difference

Example:

Input:
7 3
7 3 2 4 8 12 56

Output:
2

Explanation:
We need to pick 3 marks for three students (m=3). If we pick 2, 3 and 4, the difference is minimum which is 2.


On this page of the site you can watch the video online NPTEL |The Joy of computing using Python | WEEK 11| Programming Assignment-1 Marks distribution with a duration of hours minute second in good quality, which was uploaded by the user Ultimate Gamer 05 October 2019, share the link with friends and acquaintances, this video has already been watched 3,662 times on youtube and it was liked by 17 viewers. Enjoy your viewing!