PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches
|Home/Coding & Algorithms/Google

Find maximum value in huge text file

Last updated: May 5, 2026

Quick Overview

This question evaluates a candidate's ability to design memory-efficient streaming algorithms and parallel processing strategies for extremely large files, covering skills in external-memory algorithms, file I/O, concurrency, and correctness under resource constraints.

  • hard
  • Google
  • Coding & Algorithms
  • Software Engineer

Find maximum value in huge text file

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

You are given the path to a **very large** text file on disk. The file has the following properties: - Each line contains exactly one signed 64-bit integer (in decimal). - The file size can be tens or hundreds of gigabytes, so it **cannot** be fully loaded into memory. - You have standard file I/O APIs that allow you to read the file sequentially (e.g., line by line or in chunks). ### Tasks 1. **Single-machine solution** Design an algorithm to compute the **maximum integer value** in this file. - Assume you have limited RAM (much smaller than the file size). - Discuss how you would read the file and track the result. - Give high-level pseudocode. - Analyze time and space complexity. 2. **Performance improvement / parallelization** Suppose you now have a multi-core machine or multiple machines available and want to speed up the computation. - How would you modify your approach to take advantage of parallelism (e.g., processing the file in chunks)? - Explain how you would combine partial results to get the global maximum. - Mention any edge cases or failure scenarios you would consider (e.g., very large values, empty file). Assume you do not have a database; you are working directly with the file system and your programming language's standard I/O libraries.

Quick Answer: This question evaluates a candidate's ability to design memory-efficient streaming algorithms and parallel processing strategies for extremely large files, covering skills in external-memory algorithms, file I/O, concurrency, and correctness under resource constraints.

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
Dec 8, 2025, 7:29 PM
Software Engineer
Technical Screen
Coding & Algorithms
10
0

You are given the path to a very large text file on disk. The file has the following properties:

  • Each line contains exactly one signed 64-bit integer (in decimal).
  • The file size can be tens or hundreds of gigabytes, so it cannot be fully loaded into memory.
  • You have standard file I/O APIs that allow you to read the file sequentially (e.g., line by line or in chunks).

Tasks

  1. Single-machine solution
    Design an algorithm to compute the maximum integer value in this file.
    • Assume you have limited RAM (much smaller than the file size).
    • Discuss how you would read the file and track the result.
    • Give high-level pseudocode.
    • Analyze time and space complexity.
  2. Performance improvement / parallelization
    Suppose you now have a multi-core machine or multiple machines available and want to speed up the computation.
    • How would you modify your approach to take advantage of parallelism (e.g., processing the file in chunks)?
    • Explain how you would combine partial results to get the global maximum.
    • Mention any edge cases or failure scenarios you would consider (e.g., very large values, empty file).

Assume you do not have a database; you are working directly with the file system and your programming language's standard I/O libraries.

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.