Code RoomFlaky job names
EasyPrep Room Coding #515

Flaky job names

CodingAlgorithms & data structuresEntry–Mid~11 min

Your CI runs jobs many times a day and logs one line per run: "<job> <result>", where result is "pass" or "fail". A job is considered flaky when the SAME job name has at least one "pass" run and at least one "fail" run in the log. A job that always passes, or always fails, is not flaky. Return the flaky job names sorted alphabetically; return an empty list if none qualify.

Implement
flaky_jobs(lines: list[str]) → list[str]
Examples
in[["build pass","test fail","test pass","lint pass"]]out["test"]
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 11 min
InputExpectedGot
[["build pass","test fail","test pass","lint pass"]]["test"]not run yetsample