Practice

Running Club Top 3 & Certificates

HARDAlgorithms

A running club records names and times (in seconds) for 4 members in a 1-km race. Store them in parallel arrays, sort in ascending order of time (fastest first), output the top 3 runners, and count how many earned a certificate (time strictly less than 240 seconds).

Input: 8 alternating lines: Name, Time, Name, Time… Output: "First: [Name]", "Second: [Name]", "Third: [Name]", then "Certificates: [Count]".

Example:

Input:  Alice
        230
        Bob
        250
        Charlie
        210
        Dave
        235
Output: First: Charlie
        Second: Alice
        Third: Dave
        Certificates: 3
Premium is coming soon. All grading features are currently unlocked.

Sample Test Cases

Test 1: Unsorted, 3 certificates
Inputs: Alice, 230, Bob, 250, Charlie, 210, Dave, 235
Expected: First: Charlie Second: Alice Third: Dave Certificates: 3
Test 2: Already sorted, 0 certs
Inputs: Zara, 240, Yara, 241, Xara, 242, Wara, 243
Expected: First: Zara Second: Yara Third: Xara Certificates: 0
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade