← 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-flavored than I expected. Just the one question from what I can tell, no behavioral stuff mentioned.

Questions Asked (1)

Q1

Given a list of (userId, timestamp) events and a timeout value, group each user's consecutive events into sessions where the gap between adjacent events is within the timeout. Return the total session count across all users.

Algorithms & Data Structures
Author's notes

Took me a minute to realize you have to handle each user independently before summing anything up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the input format and edge cases, then propose sorting events by userId and timestamp. For each user, iterate through sorted events and start a new session whenever the gap exceeds the timeout, incrementing a global counter. Analyze time and space complexity, and discuss potential optimizations like using a hash map for grouping.

Pro tip: Mention that timestamps might need normalization (e.g., to milliseconds) and that using a stable sort preserves order for equal timestamps. Also, consider if events are already grouped by user to avoid sorting overhead.

1. Clarify requirements and edge cases

Ask about input format, timestamp units, whether events are pre-sorted, and how to handle empty lists or single events. Confirm that sessions are per-user and gaps are strictly greater than timeout.

2. Choose data structures and algorithm

Decide to sort events by userId and timestamp, then iterate. Use a hash map to group events by user if sorting by userId is costly, but sorting is simpler. Maintain a session count.

3. Implement session grouping logic

For each user, initialize session count to 1 if events exist. Iterate through sorted events, and when the gap between current and previous event exceeds timeout, increment session count.

4. Analyze complexity and optimize

State time complexity O(n log n) due to sorting, space O(n) for sorted array or O(k) for hash map. Discuss if we can avoid sorting by using a map and sorting each user's events individually.

5. Test with examples and edge cases

Walk through a small example, test empty input, single user with multiple sessions, and multiple users. Verify that gaps exactly equal to timeout do not start a new session.

Key Points to Mention

  • Sorting events by userId and timestamp to process sequentially.
  • Using a hash map to group events by user if input is unsorted.
  • Session count increment when gap > timeout, not >=.
  • Time complexity O(n log n) and space O(n).
  • Handling edge cases: empty list, single event, all events within timeout.
  • Clarifying timestamp units and potential overflow.

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