← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Google technical phone screen, probably for a software engineering role. One question, but it had layers I didn't fully appreciate until after I hung up.

Questions Asked (1)

Q1

Print every positive integer from 1 up to 10^1000 minus 1, where numbers can have up to 1000 decimal digits. You can't use built-in big integer types, so how do you represent and increment these numbers, and what do you say when they ask why you can't actually run this?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

My first instinct was to reach for a bignum library and I had to stop myself.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Represent each number as an array of decimal digits (least significant first) and implement an increment operation that handles carries, similar to manual addition. Then explain that while the algorithm is correct, printing up to 10^1000 - 1 numbers is computationally infeasible due to the sheer number of iterations and output size, so you would discuss the theoretical solution and practical limitations.

Pro tip: Acknowledge the impossibility upfront and pivot to discussing the algorithmic design and trade-offs, showing that you understand both the theoretical and practical aspects. This demonstrates maturity and avoids wasting time on an unfeasible task.

1. Clarify the problem and constraints

Restate the problem: print all positive integers from 1 to 10^1000 - 1 without built-in big integers. Confirm that the output size is astronomically large and that actual execution is impossible.

2. Design the digit representation

Choose an array of digits (e.g., integers 0-9) with the least significant digit first, or a string, to represent arbitrarily large numbers. Explain why this avoids built-in big integer types.

3. Implement the increment operation

Write a function that increments the digit array, handling carries by iterating from the least significant digit, setting digits to 0 and propagating carry until no carry remains. If a carry exceeds the most significant digit, append a new digit 1.

4. Outline the printing loop

Describe a loop that starts with the number 1 and repeatedly increments and prints until reaching 10^1000 - 1. Mention that the loop would run 10^1000 - 1 times, which is infeasible.

5. Address the impossibility and trade-offs

Explain that the number of iterations and output size (roughly 10^1000 * 1000 digits) far exceed any physical limits, so the code cannot be run. Discuss alternative interpretations, such as printing a subset or using a generator, and emphasize understanding of algorithmic complexity.

Key Points to Mention

  • Digit array representation (least significant digit first) to simulate big integers.
  • Increment algorithm with carry propagation, including handling overflow by adding a new digit.
  • Time complexity: O(n) per increment, where n is the number of digits, but total operations O(10^1000 * 1000).
  • Space complexity: O(n) for the digit array, but output size is O(10^1000 * 1000) digits.
  • Practical impossibility: 10^1000 iterations is far beyond any computational capacity; even storing the output is impossible.
  • Alternative approaches: use a generator to avoid storing all numbers, but still infeasible to complete.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.