1p3a Experience · Nov 2025

SmartNews Senior Data Engineer Interview Experience Overview

SWE Senior

Interview Experience

Problem Statement The technical assessment focused on an algorithm to calculate the total "active time" a user spends on an app. The input provided is a list of log entries, where each entry conta

Full Details

Problem Statement The technical assessment focused on an algorithm to calculate the total "active time" a user spends on an app. The input provided is a list of log entries, where each entry contains a timestamp and an event type (e.g., app_open, scroll, click, app_close). The complexity lies in defining when a session ends. The algorithm must handle two scenarios: 1. Explicit Termination: An app_close event immediately ends the session. 2. Implicit Termination (Timeout): If a user performs an action but no subsequent event occurs within a defined threshold (e.g., 60 seconds), the session is considered valid only up to the time of that last action. Solution The solution requires a chronological processing of events to merge continuous intervals of activity. 1. Preprocessing: Sort the log entries by timestamp to ensure the data is processed in linear time order. 2. State Management: Initialize variables to track the current_session_start and the last_seen_event_time. 3. Execution Loop: Iterate through the sorted events: * Calculate the time difference between the current event and the last_seen_event_time. * If the difference is within the timeout threshold, the session is continuous; update the last_seen_event_time to the current timestamp. * If the difference exceeds the threshold (or if an explicit app_close is encountered), finalize the current session. Add the duration (last_seen_event_time - current_session_start) to the total active time and reset the start variables for a new session. 4. Finalization: After the loop completes, check for any remaining active session and apply the timeout logic to add the final segment to the total duration. This approach effectively handles disjointed activity logs and edge cases where users exit the app without triggering a specific close event.

Free preview. Unlock all questions →