Slow endpoint paths

Write codeMedium14 min

Your task

A latency log has one line per request: "<path> <latency_ms>" with integer latency. An endpoint is flagged slow when its AVERAGE latency across all its requests is at least the threshold. Return the flagged paths sorted alphabetically. Do the comparison with integers only: an average sum/count >= threshold is exactly the condition sum >= threshold * count, which avoids float rounding entirely. Return an empty list when nothing is flagged or the log is empty.

Examples

slow_endpoints(lines: list[str], threshold: int) -> list[str]
Example 1
Inputslow_endpoints(["/a 100", "/a 300", "/b 100"], 200)
Output["/a"]