93. Highest Scoring Student
Core1000 ms256 MBSolved by 0%
Read n student records, one per line, each holding a name with no spaces
and a mark.
Print the name and mark of the student with the highest mark, separated by a space.
If two students tie, print the one that appeared first.
Constraints - `1 ≤ n ≤ 100000` - Names are 1 to 30 letters with no spaces. - `-1000 ≤ mark ≤ 1000`
Input
The first line contains an integer n.
Each of the next n lines contains a name and a mark, separated by a space.
Output
Print the name and mark of the top student, separated by a single space. On a tie print the one that appeared first.
Input3
Aravind 80
Divya 92
Nithya 75
OutputDivya 92
Notehas the top student in the middle
Input2
Ram 50
Sita 50
OutputRam 50
Notehas a tie, so the first student wins
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.