def debug_view(agent_chunks: list[tuple[int, int, str]],
user_chunks: list[tuple[int, int, str]],
toolcall_chunks: list[tuple[int, int, str]]) -> list[str]:The round: one Sierra report thread, in which three candidates describe the same question. The poster calls it "debug view": time intervals with text, printed in order, much like merge intervals, with a follow-up about overlaps and gaps; they heard the same day that they were moving on to the onsite. Another candidate got it as an extra coding round after failing an onsite coding round, in four parts in 45 minutes. A third posted the sample input below. Part 1 is most of the code; Parts 2 to 4 are a few lines each. Four graded parts.
Input — the reported sample
A call between a user and an AI agent (the sample opens with "thanks for calling"), recorded as three lists of chunks. Each chunk is (start_ms, end_ms, text), and the lists are not sorted:
agent_chunks = [(3600, 4000, "inventory for you."), (0, 600, "Hi there, thanks for calling"), ...]
user_chunks = [(2300, 2800, "waterproof daypack for a short"), (1800, 2300, "Hi! I'm looking for a"), ...]
toolcall_chunks = [(4000, 4600, "search_inventory")]
Part 1 — merge the chunks into one transcript
def debug_view(agent_chunks, user_chunks, toolcall_chunks) -> list[str]:
"[start-end] speaker: text", with speaker user, agent or tool.[0-1800] agent: Hi there, thanks for calling Sierra Outfitters. What gear can I help you find today? and then [1800-3200] user: Hi! I'm looking for a waterproof daypack for a short hike.ValueError.Notes: the four parts and the reported strings "... [INTERRUPTED]" and "...[xx ms gap]..." come from the reports. These are ours: the names and signatures of debug_view and p50_think_time, the line format, joining text with a space, merging only touching or overlapping chunks, ties at the same start going user, agent, tool, the ValueError rule, marking an interruption only when the user starts inside the agent turn, keeping an interrupted turn's full text, marking gaps only from a user turn to the next agent turn, and for p50 the even-count rule, the nearest_rank flag, returning None with no gaps, and not counting gaps of zero. Ask about each one.
One thread, three candidates. The poster found it not hard and moved on to an onsite. Another got it as an extra coding round after failing their onsite coding round, with four parts in 45 minutes, and their advice is not to panic: Part 1 is most of the code, and once it is written you are about 85% done. The sample input in the reported thread is a support call to an outdoor-gear store, with a tool call to search the inventory between two agent turns. The exact output format was not reported, so settle it with the interviewer before writing the formatting code.
What the reports say: very close to merge intervals, and not hard. Four parts in 45 minutes; Part 1 is most of the code and the other three are a few lines each, so do not panic. One candidate got it as an extra coding round after failing an onsite coding round.
Common mistakes (ours, not reported): merging across speakers before merging within each speaker; forgetting that the chunks arrive unsorted; treating chunks that touch end to start as separate turns; formatting strings in Part 1 and parsing them back later; crashing on an empty gap list in Part 4.
Edge cases to test (ours): the reported sample (no overlaps, no gaps); a same-speaker pause; overlapping chunks of one speaker; a user who starts exactly when the agent stops; an agent who starts while the user is still talking; an even number of gaps for p50; no gaps at all.
Alternative approaches (ours): a single heap merge of the three sorted per-speaker lists instead of one combined sort; for Part 2, sort the user start times and binary-search each agent turn.
Also reported as Merge Transcript Intervals
The round: one Sierra report thread, in which three candidates describe the same question. The poster calls it "debug view": time intervals with text, printed in order, much like merge intervals, with a follow-up about overlaps and gaps; they heard the same day that they were moving on to the onsite. Another candidate got it as an extra coding round after failing an onsite coding round, in four parts in 45 minutes. A third posted the sample input below. Part 1 is most of the code; Parts 2 to 4 are a few lines each. Four graded parts.
Input — the reported sample
A call between a user and an AI agent (the sample opens with "thanks for calling"), recorded as three lists of chunks. Each chunk is (start_ms, end_ms, text), and the lists are not sorted:
agent_chunks = [(3600, 4000, "inventory for you."), (0, 600, "Hi there, thanks for calling"), ...]
user_chunks = [(2300, 2800, "waterproof daypack for a short"), (1800, 2300, "Hi! I'm looking for a"), ...]
toolcall_chunks = [(4000, 4600, "search_inventory")]
Part 1 — merge the chunks into one transcript
def debug_view(agent_chunks, user_chunks, toolcall_chunks) -> list[str]:
"[start-end] speaker: text", with speaker user, agent or tool.[0-1800] agent: Hi there, thanks for calling Sierra Outfitters. What gear can I help you find today? and then [1800-3200] user: Hi! I'm looking for a waterproof daypack for a short hike.ValueError.Part 2 — mark interrupted agent turns
"... [INTERRUPTED]". The agent turn still prints first, since it started first.Part 3 — show the agent's think-time gaps
"...[xx ms gap]..." between the two, where xx is the gap in ms.Part 4 — p50 agent think time
def p50_think_time(agent_chunks, user_chunks, toolcall_chunks, nearest_rank: bool = False) -> float | None:
None when there is no gap.nearest_rank=True takes the lower of the two instead.Notes: the four parts and the reported strings "... [INTERRUPTED]" and "...[xx ms gap]..." come from the reports. These are ours: the names and signatures of debug_view and p50_think_time, the line format, joining text with a space, merging only touching or overlapping chunks, ties at the same start going user, agent, tool, the ValueError rule, marking an interruption only when the user starts inside the agent turn, keeping an interrupted turn's full text, marking gaps only from a user turn to the next agent turn, and for p50 the even-count rule, the nearest_rank flag, returning None with no gaps, and not counting gaps of zero. Ask about each one.
What the reports say: very close to merge intervals, and not hard. Four parts in 45 minutes; Part 1 is most of the code and the other three are a few lines each, so do not panic. One candidate got it as an extra coding round after failing an onsite coding round.
Common mistakes (ours, not reported): merging across speakers before merging within each speaker; forgetting that the chunks arrive unsorted; treating chunks that touch end to start as separate turns; formatting strings in Part 1 and parsing them back later; crashing on an empty gap list in Part 4.
Edge cases to test (ours): the reported sample (no overlaps, no gaps); a same-speaker pause; overlapping chunks of one speaker; a user who starts exactly when the agent stops; an agent who starts while the user is still talking; an even number of gaps for p50; no gaps at all.
Alternative approaches (ours): a single heap merge of the three sorted per-speaker lists instead of one combined sort; for Part 2, sort the user start times and binary-search each agent turn.
If you have had this round, tell us how close this page was. It is how we keep the pages accurate.