Peak Concurrent Viewers Across LinkedIn Live Sessions

Last updated: November 29, 2026

Quick Overview

Given viewer sessions as half-open intervals [join, leave) in seconds, return the maximum number of simultaneous viewers and the earliest time that maximum is reached.

LinkedIn
Coding & Algorithms
Software Engineer
LinkedIn
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Given viewer sessions as half-open intervals [join, leave) in seconds, return the maximum number of simultaneous viewers and the earliest time that maximum is reached.

LinkedIn Live needs concurrency numbers for capacity and for the creator analytics dashboard. The onsite coding interviewer wants a sweep line with careful tie handling at equal timestamps, then discussion of streaming the same idea.

What the Interviewer Expects
  • Converts intervals into +1 and -1 events
  • Orders a leave before a join at the same timestamp for half-open intervals
  • Tracks the running count and the first time the max is hit
  • Explains why sorting events beats checking every second
  • Discusses a streaming or bucketed version for live dashboards
Key Topics to Cover
sweep line
intervals
event sorting
concurrency
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How do you compute this per minute bucket for a dashboard chart?
  • What if sessions arrive as an unbounded stream with late events?
  • How would you return all maximal time ranges, not just the first?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Each session is [join, leave), so a viewer who leaves at t=10 and one who joins at t=10 never overlap. Return (max_viewers, earliest_time). For no sessions return (0, None). Sessions with `leave...

High-Level Design

Create an event (time, delta) with +1 at join and -1 at leave. Sort by time, then by delta so -1 comes before +1 at the same time; that is exactly the half-open rule. Sweep, keep the running...


Submit Your Answer
Markdown supported