Jobs exceeding duration limit

Write codeMedium13 min

Your task

A CI system logs "<job> <ts> START" when a job begins and "<job> <ts> END" when it finishes, with ts as integer Unix seconds. Runs of different jobs interleave freely, but each job name appears exactly once as START and exactly once as END, with the END timestamp later. Given the log lines (chronological) and a duration limit in seconds, return the names of all jobs whose run took STRICTLY longer than the limit, sorted alphabetically.

Examples

overrunning_jobs(lines: list[str], limit: int) -> list[str]
Example 1
Inputoverrunning_jobs(["nightly-backup 100 START", "report-gen 120 START", "report-gen 200 END", "nightly-backup 700 END"], 300)
Output["nightly-backup"]