Code Room
CodingEasycod-g1325
Subject Log processingLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

During an incident review you must extract the slice of a web server log that falls inside the incident window. Each line begins with a sortable timestamp string like "2026-07-01T10:00:00" followed by a space and the entry text; comparing timestamps as plain strings gives chronological order. Given the lines (any order is possible) and two timestamps start and end (start <= end), return every line whose timestamp satisfies start <= timestamp <= end, keeping the lines in their original order.

Implement
lines_in_range(lines: list[str], start: str, end: str) → list[str]
Examples
in[["2026-07-01T09:59:00 INFO warmup","2026-07-01T10:00:00 ERROR spike begins","2026-07-01T10:05:00 ERROR still bad","2026-07-01T10:20:00 INFO recovered"],"2026-07-01T10:00:00","2026-07-01T10:10:00"]out["2026-07-01T10:00:00 ERROR spike begins","2026-07-01T10:05:00 ERROR still bad"]
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.

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.

Run or narrate your approach, then ask the coach.