Question
Each line of a platform log has the form "<timestamp> <LEVEL> <service> <message>". A service's error rate is the number of its ERROR lines divided by its total lines. Given at least one line, return the name of the service with the highest error rate. If several services tie on rate, return the alphabetically smallest name among them. Prefer exact integer arithmetic over floating-point division — rates like 1/3 do not compare cleanly as floats.
worst_error_service(lines: list[str]) → str[["t1 ERROR auth login failed","t2 INFO auth ok","t3 ERROR billing charge failed","t4 ERROR billing retry failed","t5 INFO search ok"]]out"billing"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.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.