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
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution