Problem of the day
Input: ‘N’ = 3, ‘STUDENTS’ = [[‘naruto’, 50], [‘sasuke’, 95], [‘sakura’, 65]]
Output: [[‘sasuke’, 95], [‘sakura’, 65], [‘naruto’, 50]]
In the example above you can see that ‘sasuke’ got the highest marks so he came first in the output followed by ‘sakura’ and ‘naruto’ with the lowest marks.
The first line will contain the integer 'T', denoting the number of test cases.
For each test case, the first line will contain a single integer 'N', the number of students in the class.
The next ‘N’ line contains two elements first is a string representing the name of the student and the second is an integer denoting the marks of the student.
For each test case print the elements in the defined order above.
You don't need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10
1 <= N <= 10^5
1 <= L <= 20
0 <= M <= 100
The Sum of the value of N for all the test cases is <= 10^5.
Time Limit: 1 sec
Here ‘L’ is the size of the string representing the name of the student and ‘M’ is the marks of the student.
2
3
naruto 50
sakura 65
sasuke 95
2
kiba 70
shikamaru 78
sasuke 95
sakura 65
naruto 50
shikamaru 78
kiba 70
For the first case:-
You can see that ‘sasuke’ got the highest marks so he came first in the output followed by ‘sakura’ and ‘naruto’ with the lowest marks.
For the second case-
Here ‘shikamaru’ got 78 marks greater than 70 so he comes first followed by ‘kiba’ with 70 marks.
2
5
minato 92
sakumo 87
itachi 99
madara 92
ino 80
3
minato 90
madara 90
hiruzen 90
itachi 99
madara 92
minato 92
sakumo 87
ino 80
hiruzen 90
madara 90
minato 90