Code RoomExtract error messages
EasyPrep Room Coding #522

Extract error messages

CodingAlgorithms & data structuresEntry–Mid~10 min

You are building a tiny report generator for a cron runner's log. Each line is "<timestamp> <LEVEL> <message>", and the message itself may contain several words. Extract the messages of all lines whose level token (the second token) is exactly "ERROR": return just the message texts — timestamp and level stripped — in the order the lines appear. A word like "ERROR" inside some other line's message must not cause that line to be included.

Implement
error_messages(lines: list[str]) → list[str]
Examples
in[["t1 ERROR disk full","t2 INFO rotation done","t3 ERROR net down"]]out["disk full","net down"]
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 10 min
InputExpectedGot
[["t1 ERROR disk full","t2 INFO rotation done","t3 ERROR net down"]]["disk full","net down"]not run yetsample