Compute Agent Talk Time and Crosstalk From Diarized Segments
Last updated: November 29, 2026
Quick Overview
Given diarized speech segments (speaker, start, end) from a call, possibly overlapping and unsorted, return total talk time per speaker and the total seconds where the agent and customer spoke at the same time.
Cresta
November 29, 20260
0
0 solved
Given diarized speech segments (speaker, start, end) from a call, possibly overlapping and unsorted, return total talk time per speaker and the total seconds where the agent and customer spoke at the same time.
Talk ratio and crosstalk (interruptions) are standard conversation-intelligence metrics in Cresta's Insights and coaching products, computed from ASR and diarization output. A phone screen uses this to check clean interval handling and whether the candidate notices that one speaker's own segments can overlap.
What the Interviewer Expects
- Merge each speaker's segments before summing so self-overlaps are not double counted
- Compute agent and customer overlap with a two-pointer sweep over merged lists
- State O(n log n) complexity from sorting
- Handle empty input, zero-length segments and a missing speaker
- Keep the function pure and easy to test
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you count the number of distinct interruptions rather than total overlapping seconds?
- How would you generalize overlap to three or more speakers, such as a conference transfer?
- How would you compute this incrementally while the call is still live?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: list of (speaker, start, end) with speaker in {agent, customer}, times in seconds, unsorted. Diarization can emit overlapping segments for the same speaker (for example a re-segmented par...
High-Level Design
- Group segments by speaker.
- Sort and merge each speaker's intervals.
- Talk time is the sum of merged lengths.
- Crosstalk is the intersection length of the two merged lists, found with a two-p...