← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Google coding screen for a software engineer role. One problem, fairly niche constraints, left me second-guessing my solution the whole time.

Questions Asked (1)

Q1

Given a positive integer, determine whether it qualifies as a 'Perfect Wake Number': no repeated digits, no zeros, and no digit that is strictly smaller than both of its neighbors.

Algorithms & Data Structures
Author's notes

Took me a minute to even parse the constraint about adjacent digits.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the definition of 'Perfect Wake Number' and confirm edge cases (e.g., single-digit numbers). Then, propose an efficient algorithm that checks the three conditions in a single pass over the digits, using a set to detect repeats and comparing each digit with its neighbors to ensure no digit is a local minimum. Discuss time and space complexity, and consider optimizations or alternative approaches.

Pro tip: Demonstrate thoroughness by discussing edge cases upfront (e.g., numbers with 1 or 2 digits) and how your solution handles them, as interviewers at Google value attention to detail and robustness.

1. Clarify requirements and edge cases

Restate the problem in your own words and ask clarifying questions about edge cases, such as single-digit numbers or numbers with leading zeros (though input is a positive integer, so no leading zeros).

2. Design the algorithm

Outline a step-by-step approach: convert the integer to a string or extract digits, check for zeros and repeated digits using a set, and then iterate through the digits to ensure no digit is strictly smaller than both neighbors.

3. Analyze complexity and optimize

State the time complexity (O(d) where d is the number of digits) and space complexity (O(1) if using a fixed-size boolean array for digits, or O(d) for a set). Discuss potential optimizations, such as early termination.

4. Implement and test

Write clean code (in a language of your choice) and walk through test cases, including valid and invalid numbers, to verify correctness.

5. Discuss alternative approaches

Mention any alternative methods, such as generating all valid numbers up to a certain length, and compare trade-offs.

Key Points to Mention

  • Definition and conditions of a Perfect Wake Number
  • Handling of edge cases (single-digit, two-digit numbers)
  • Use of a set or boolean array to detect repeated digits and zeros
  • Single-pass iteration to check the 'no local minimum' condition
  • Time and space complexity analysis
  • Potential optimizations and alternative approaches

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