Code RoomTop walkers with ties
EasyPrep Room Coding #4831

Top walkers with ties

CodingAlgorithms & data structuresEntry–Mid~15 min

A weekend step challenge for a hospital charity hands out prizes to the top k walkers, and the rules never break a tie at the cutoff: anyone who matched the last prize winning total wins as well, so the prize list can run longer than k. names holds the walkers and steps holds the total each one logged, one entry per walker, in the same order. Return the winners ordered by steps from high to low. Walkers on the same total are listed by name in plain text order, where every capital letter sorts ahead of every lowercase letter. Return an empty list when k is zero or below, and every walker when k is at least as large as the field.

Implement
prize_cutoff_names(names: list[str], steps: list[int], k: int) → list[str]
Examples
in[["Nadia","Owen","Priya","Quinn"],[9100,12400,9100,7300],2]out["Owen","Nadia","Priya"]
in[["Rosa","Sam","Tomas"],[5000,5000,5000],1]out["Rosa","Sam","Tomas"]
in[["Uma","Vic"],[800,1500],5]out["Vic","Uma"]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 15 min
InputExpectedGot
[["Nadia","Owen","Priya","Quinn"],[9100,12400,9100,7300],2]["Owen","Nadia","Priya"]not run yetsample
[["Rosa","Sam","Tomas"],[5000,5000,5000],1]["Rosa","Sam","Tomas"]not run yetsample
[["Uma","Vic"],[800,1500],5]["Vic","Uma"]not run yetsample