Representatives
The principal of a school wants to speak with some of the students to as the overall development including studies. Mont of the teachers were selecting the toppers of their classes but Mr. Sam thought of an idea to select the bunch of students who did not have much difference in their marks so that he gains the reputation of a teacher who teaches well to the whole class and not just to a bunch of brilliant students.You are required to help Mr Sam in selecting K students that can speak with the principal from his class. You need to return an integer array representing the marks of the selected students sorted in ascending order.
Output Specification:
Return an integer array containing the marks of K selected students sorted in ascending order
Example 1:
input1: 10
input2: {950,477, 55, 602,881,302,859,438,551,382}
input3: 1
Output: {950}
The answer to your question is provided in the image:
Comments
Leave a comment