Customer Peak Call Tracker
HubSpot interview questions · Medium · Coding round · 6 tests
A billing platform tracks user sessions for resource metering. Each session has a start time and an end time in Unix milliseconds. For every user and every UTC calendar date with activity, return the moment that user reached their maximum number of concurrent sessions.
Function signature
interface Session {
userId: number;
sessionId: string;
startTimestamp: number;
endTimestamp: number;
}
interface DailyPeak {
userId: number;
date: string; // YYYY-MM-DD in UTC
maxConcurrentSessions: number;
timestamp: number;
sessionIds: string[];
}
calculateDailyPeakSessions(sessions: Session[]): DailyPeak[]
Rules
Run your code with Ctrl+Enter to see results.