Aggregate Raw Connections Into Flow Summaries With Idle Gaps
Last updated: November 29, 2026
Quick Overview
Given raw connection events (ts, src, dst, port, proto, bytes) in arbitrary order, group them into flow summaries per 5-tuple key where a new summary starts whenever the gap since the key's previous event exceeds T seconds. Return first seen, last seen, count and total bytes for each summary.
Illumio
November 29, 20260
0
0 solved
Given raw connection events (ts, src, dst, port, proto, bytes) in arbitrary order, group them into flow summaries per 5-tuple key where a new summary starts whenever the gap since the key's previous event exceeds T seconds. Return first seen, last seen, count and total bytes for each summary.
VENs do not ship every connection to the PCE; they summarize repeated connections so the traffic map stays affordable at enterprise scale. The interviewer checks grouping, sessionization by gap, and that you think about the bandwidth and accuracy trade-off of the summary.
What the Interviewer Expects
- Groups by the full key, not just source and destination
- Sorts events per key before sessionizing
- Splits summaries on gaps strictly greater than T
- Accumulates count and bytes correctly
- Produces deterministic output ordering
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
- The agent has limited memory. How would you bound the number of open summaries?
- How would you do this on a stream where events are nearly sorted?
- Which fields would you add so the PCE can tell a policy decision changed mid-summary?
- How do you merge summaries computed on two different hosts for the same flow?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Key is (src, dst, port, proto). Two consecutive events for the same key belong to the same summary if ts - last_seen <= T. Output summaries sorted by first seen then key so results are stable for ...
High-Level Design
Bucket events by key in a dictionary, sort each bucket by timestamp, then walk it keeping the current open summary. When the gap is too large, close the current summary and open a new one. This is the...