PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Google

Find shared objects across two log files

Last updated: Mar 29, 2026

Quick Overview

This question evaluates the ability to design efficient algorithms and data-processing strategies for identifying shared object identifiers across large log files, testing skills in streaming processing, set membership handling, and external-memory algorithm reasoning.

  • medium
  • Google
  • Coding & Algorithms
  • Software Engineer

Find shared objects across two log files

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given two large log files representing activity on two different days. Each line of each log has three fields: - `timestamp`: a time value (you may treat it as an opaque string or integer) - `obj_id`: identifier of an object (string or integer) - `client_id`: identifier of a client (string or integer) The logs are not necessarily sorted by any field. Define an object as **interesting** if: 1. Its `obj_id` appears at least once in day 1's log **and** at least once in day 2's log; and 2. Across all of its appearances in both days combined, it is associated with at least **two distinct** `client_id` values. ### Tasks 1. Design and implement a function that, given file handles (or streaming iterators) for the two log files, returns the set of all such interesting `obj_id`s. 2. For your initial, straightforward in-memory solution (you may assume both logs fit in memory), state the time and space complexity in terms of the total number of log records. 3. Follow-up (memory constrained): Now assume the logs are very large and **cannot** both fit into memory at once. - You may still sequentially scan each file and you may perform external sorting. - Describe how you would modify your approach to work under this memory constraint. - Analyze the time and space complexity of this memory-efficient solution.

Quick Answer: This question evaluates the ability to design efficient algorithms and data-processing strategies for identifying shared object identifiers across large log files, testing skills in streaming processing, set membership handling, and external-memory algorithm reasoning.

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
Nov 5, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
3
0

You are given two large log files representing activity on two different days. Each line of each log has three fields:

  • timestamp : a time value (you may treat it as an opaque string or integer)
  • obj_id : identifier of an object (string or integer)
  • client_id : identifier of a client (string or integer)

The logs are not necessarily sorted by any field.

Define an object as interesting if:

  1. Its obj_id appears at least once in day 1's log and at least once in day 2's log; and
  2. Across all of its appearances in both days combined, it is associated with at least two distinct client_id values.

Tasks

  1. Design and implement a function that, given file handles (or streaming iterators) for the two log files, returns the set of all such interesting obj_id s.
  2. For your initial, straightforward in-memory solution (you may assume both logs fit in memory), state the time and space complexity in terms of the total number of log records.
  3. Follow-up (memory constrained): Now assume the logs are very large and cannot both fit into memory at once.
    • You may still sequentially scan each file and you may perform external sorting.
    • Describe how you would modify your approach to work under this memory constraint.
    • Analyze the time and space complexity of this memory-efficient solution.

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.