FastPrepMaximum Number in a Large File
Problems/Maximum Number in a Large File

Maximum Number in a Large File

Google logoGoogle● EasyNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The firsthand new-grad report from Google asks for the maximum value in a very large text file with one number per line. It then asks for a faster version that splits the work into chunks in parallel. Here the input is an array of the parsed file lines. The editorial keeps the discussion of streaming and parallel reduction.

A very large text file contains one signed integer per line. Return the maximum integer in the file.

Your function gets the parsed lines as an array numbers. Use only a constant amount of extra memory, so the same logic could read a file as a stream without loading every line at once.

Function

maximumFileNumber(numbers: long[]) → long

Examples

Example 1

numbers = [-5,7,2]return = 7

Seven is larger than the other file values.

Example 2

numbers = [42]return = 42

A one-line file returns its only number.

Example 3

numbers = [-9,-3,-12]return = -3

The maximum can still be negative.

Constraints

  • 1 <= numbers.length <= 1000000.
  • Every value fits in a signed 64-bit integer.

More Google Phone Screen questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Merchant Payout Reserve CalculatorStripe · PHONE SCREEN
  • Price CheckBlue Origin · PHONE SCREEN
  • Best Time to Buy and Sell StockMeta · PHONE SCREEN
  • Lazy Filter over a GeneratorSquarepoint Capital · PHONE SCREEN
  • Second Largest Distinct ElementAmazon · PHONE SCREEN
  • Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREEN
  • Search and Format ContactsAdyen · PHONE SCREEN
  • Majority ElementByteDance · PHONE SCREEN
  • Detect a Straight FlushTemu · PHONE SCREEN
  • Recommend Films from Viewers Who Watched Everything You DidBloomberg LP · PHONE SCREEN

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
See Google hiring insights
Saved
class Solution {
    public long maximumFileNumber(long[] numbers) {
        // Write your code here.
    }
}
Checking account…