harbor run -t openthoughts/tasktrove-exp-rpt-taco-v2-taco-8900harbor download openthoughts/tasktrove-exp-rpt-taco-v2-taco-8900To participate in a prize draw, each participant submits their firstname. Each letter in a firstname has a value corresponding to its rank in the English alphabet (A/a = 1, B/b = 2, ..., Z/z = 26). The length of the firstname is added to the sum of these letter values to compute a number called som.
This som is then multiplied by a corresponding weight to obtain a winning number. The participants are sorted by their winning numbers in descending order. In case of ties, they are sorted alphabetically by firstname.
st : A string of comma-separated firstnames (e.g., "COLIN,AMANDBA,AMANDAB,CAROL,PauL,JOSEPH").we : An array of integers representing weights corresponding to each firstname (e.g., [1, 4, 4, 5, 2, 1]).n : An integer representing the rank (1-based index) of the participant whose firstname you want to return.n.
st is empty, return "No participants".n is greater than the number of participants, return "Not enough participants".st = "COLIN,AMANDBA,AMANDAB,CAROL,PauL,JOSEPH"
we = [1, 4, 4, 5, 2, 1]
n = 4
"PauL"
Calculate som for each participant:
som = 6 + 53 = 59som = 8 + 36 = 44som = 8 + 36 = 44som = 5 + 49 = 54som = 4 + 50 = 54som = 6 + 73 = 79Calculate winning numbers:
Sort participants by winning number:
The 4th ranked participant is "PauL".
Place the solution in the /app/ directory.
Important: place your implementation at /app/solution.py so the verifier can run it.