PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Google

Count user sessions from logs

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to parse and process large-scale event logs, perform sessionization based on time gaps, handle out-of-order records and memory constraints, and reason about time and space complexity and optimization strategies in the Coding & Algorithms domain.

  • Medium
  • Google
  • Coding & Algorithms
  • Software Engineer

Count user sessions from logs

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Given a large log file where each line is "timestamp,user,action", compute the number of sessions per user. Assume a session ends if the gap between consecutive events for the same user exceeds a configurable timeout T minutes. The file may not be sorted; define the expected input format (e.g., ISO 8601 timestamps), describe how you would parse and group events by user, handle out-of-order records, and process data that does not fit in memory (e.g., streaming or external sort). Provide time and space complexity, discuss optimizations (e.g., indexing, windowing), and outline test cases and edge conditions (empty users, single event, boundary at exactly T, malformed lines).

Quick Answer: This question evaluates a candidate's ability to parse and process large-scale event logs, perform sessionization based on time gaps, handle out-of-order records and memory constraints, and reason about time and space complexity and optimization strategies in the Coding & Algorithms domain.

Related Interview Questions

  • Solve Flower Placement and Directory Deletion - Google (medium)
  • Compute Turnstile Crossing Times - Google (hard)
  • Simulate In-Place Cellular State Updates - Google (hard)
  • Determine Whether a Word Exists in a Graph - Google (medium)
  • Implement Checksums and Feature Rollout Evaluation - Google (medium)
Google logo
Google
Sep 6, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
6
0

Given a large log file where each line is "timestamp,user,action", compute the number of sessions per user. Assume a session ends if the gap between consecutive events for the same user exceeds a configurable timeout T minutes. The file may not be sorted; define the expected input format (e.g., ISO 8601 timestamps), describe how you would parse and group events by user, handle out-of-order records, and process data that does not fit in memory (e.g., streaming or external sort). Provide time and space complexity, discuss optimizations (e.g., indexing, windowing), and outline test cases and edge conditions (empty users, single event, boundary at exactly T, malformed lines).

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Google•More Software Engineer•Google Software Engineer•Google Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.