← Supio Interview Insights

Supio·Frontend Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Interviewed for a frontend role at Supio and got a coding problem that felt more backend-y than I expected. Just the one question from what I can tell, no behavioral stuff mentioned.

Questions Asked (1)

Q1

You're given a list of (userId, timestamp) pairs and a timeout value. Group each user's events into sessions where consecutive events are within the timeout window, then return the total session count across all users.

Algorithms & Data Structures
Author's notes

My first instinct was to sort by user and then by time, which is right, but I fumbled the session-boundary logic for a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the input format and edge cases, then propose a solution that groups events by user and sorts each group by timestamp. Iterate through each user's sorted events, counting a new session whenever the gap between consecutive events exceeds the timeout. Finally, sum the session counts across all users.

Pro tip: Mention that sorting can be done globally by (userId, timestamp) to avoid per-user sorting overhead, and that using a Map to group events is efficient. Also, discuss how to handle edge cases like empty input or single events.

1. Clarify requirements and edge cases

Ask about input size, whether timestamps are sorted, and how to handle duplicate timestamps or empty input. Confirm that sessions are per-user and that the timeout is inclusive or exclusive.

2. Choose data structures and algorithm

Use a hash map to group events by userId, then sort each user's events by timestamp. Alternatively, sort all events globally by (userId, timestamp) and process sequentially.

3. Implement session counting logic

For each user, initialize a session count to 1 if there are events. Iterate through sorted timestamps, and increment the session count whenever the difference between current and previous timestamp exceeds the timeout.

4. Sum and return total sessions

Accumulate the session counts from all users and return the total. Ensure the solution handles users with no events (though they shouldn't appear in the list).

5. Analyze complexity and optimize

Discuss time complexity: O(N log N) due to sorting, where N is total events. Space complexity: O(N) for grouping. Mention potential optimizations if input is already sorted.

Key Points to Mention

  • Grouping events by userId using a hash map for efficient lookup.
  • Sorting timestamps within each user's events to ensure chronological order.
  • Session boundary condition: gap > timeout (or >= depending on definition).
  • Time and space complexity analysis: O(N log N) time, O(N) space.
  • Edge cases: empty input, single event, all events within timeout, all events outside timeout.
  • Potential for streaming or online processing if data is large and sorted by time.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.