Problem:-
A simple question again..!
These are the people from nirmaLand who have shown utmost dedication towards Competitve Programming..!
You will be provided with name of the coder and no. of hours he/she spent on coding.
You need to output top 3 names of the coders who spent most time in coding.
Note: Time (no. of hours) given for all coders will be unique. More technically, no two coders will have same amount of time.
See the sample case for better understanding.
Input format:
First line consist of total number of coders, let's say 'n'.
Each of the next n lines consist of a string, let's say 'N' (name of coder) and a number let's say, 'T' (time).
Output format:
Output names of top 3 coders that spent maximum time in coding.
Constraints:
3 <= n <= 100
1 <= |N| <= 10
1 <= T <= 1000
Time Limit: 1Memory Limit: 256Source Limit:ExplanationHarshad spent 90 hours in coding, which is maximum, so his name is at first.
After Harshad, Nirav spent 88 hours in coding, which is maximum, so his name is second.
After Nirav, Jaimin spent 87 hours in coding, which is maximum, so his name comes third.
A simple question again..!
These are the people from nirmaLand who have shown utmost dedication towards Competitve Programming..!
You will be provided with name of the coder and no. of hours he/she spent on coding.
You need to output top 3 names of the coders who spent most time in coding.
Note: Time (no. of hours) given for all coders will be unique. More technically, no two coders will have same amount of time.
See the sample case for better understanding.
Input format:
First line consist of total number of coders, let's say 'n'.
Each of the next n lines consist of a string, let's say 'N' (name of coder) and a number let's say, 'T' (time).
Output format:
Output names of top 3 coders that spent maximum time in coding.
Constraints:
3 <= n <= 100
1 <= |N| <= 10
1 <= T <= 1000
Harshad spent 90 hours in coding, which is maximum, so his name is at first.
After Harshad, Nirav spent 88 hours in coding, which is maximum, so his name is second.
After Nirav, Jaimin spent 87 hours in coding, which is maximum, so his name comes third.
COde:-
0 Comments