← Google Interview Insights

Google·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePending
Jun 2026

Summary

Two-round screening loop at Google for a software engineer role. The DSA round went reasonably well despite a few nudges from the interviewer on minor bugs, but round 2 never happened because the interviewer was a no-show, leaving the outcome completely up in the air.

Questions Asked (3)

Q1

Given a coding problem, can you identify and fix a subtle bug that could cause a NullPointerException?

Algorithms & Data Structures
Author's notes

The interviewer had to point it out to me, which stung a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, carefully trace the code to identify where a null value could be dereferenced, focusing on method calls, field accesses, and array operations. Then, propose a fix that handles the null case appropriately, such as adding a null check, using Optional, or redesigning the method contract. Finally, explain how you would test the fix to ensure it resolves the NPE without introducing regressions.

Pro tip: Demonstrate defensive programming by mentioning that you'd also consider adding assertions or using static analysis tools to catch similar issues early. This shows you think about preventing bugs, not just fixing them.

1. Understand the code and context

Read the code thoroughly to understand its purpose, inputs, and expected behavior. Identify all variables that could be null and the conditions under which they might be null.

2. Locate the potential null dereference

Trace the execution path to find the exact line where a null value could be dereferenced, causing the NPE. Consider all possible inputs that could lead to that state.

3. Determine the root cause

Analyze why the null value occurs: is it due to missing initialization, unexpected input, or a logic error? Understanding the cause helps choose the right fix.

4. Implement a robust fix

Apply a fix that handles the null case safely, such as adding a null check, providing a default value, or throwing a more informative exception. Ensure the fix aligns with the method's contract.

5. Verify and test

Write or describe test cases that reproduce the NPE and confirm the fix works. Also, consider edge cases and potential side effects of the fix.

Key Points to Mention

  • Common sources of NullPointerException: calling methods on null objects, accessing fields of null objects, unboxing null, and array access with null indices.
  • Defensive programming techniques: null checks, Optional class, Objects.requireNonNull, and annotations like @Nullable/@NonNull.
  • The importance of understanding the method's contract and whether null is a valid input or should be rejected.
  • Testing strategies: unit tests with null inputs, boundary cases, and using assertions to catch nulls early.
  • Static analysis tools and IDE inspections that can detect potential null dereferences before runtime.
  • The trade-offs between different fixes: e.g., returning a default value vs. throwing an exception, and how that affects API design.

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

Q2

Review a piece of code and identify why it won't compile.

Algorithms & Data Structures
Author's notes

Got flagged on this one too.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by scanning the code for syntax errors, then check for type mismatches and missing imports. If no obvious errors, mentally compile the code or trace through it to identify semantic issues. Finally, explain the error clearly and suggest a fix.

Pro tip: Demonstrate systematic debugging by verbalizing your thought process and considering edge cases, rather than jumping to conclusions. Show that you can not only find the error but also explain why it occurs and how to prevent similar issues.

1. Initial Syntax Scan

Look for missing semicolons, mismatched braces, or incorrect keywords that would cause immediate compilation errors.

2. Check Types and Declarations

Verify that all variables are declared with correct types, function signatures match, and there are no type mismatches.

3. Verify Imports and Dependencies

Ensure all necessary libraries or modules are imported and that there are no missing or conflicting dependencies.

4. Trace Logic and Semantics

If no syntax errors, mentally execute the code to find semantic errors like uninitialized variables or incorrect operator usage.

5. Explain and Fix

Clearly state the compilation error, explain why it occurs, and propose a corrected version of the code.

Key Points to Mention

  • Syntax errors (e.g., missing semicolons, mismatched braces)
  • Type mismatches (e.g., assigning wrong types, incompatible operands)
  • Missing imports or undeclared variables
  • Scope issues (e.g., variable used outside its scope)
  • Language-specific pitfalls (e.g., Java's checked exceptions, C++'s forward declarations)
  • Compiler error messages and how to interpret them

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

Q3

During a dry run of your solution, verify that your method is actually doing what you think it is.

Algorithms & Data Structures
Author's notes

The interviewer asked 'are you sure your method is doing that?' and I paused and realized no, it wasn't.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Explain that a dry run is a manual, step-by-step execution of your algorithm on a small but representative input, tracking all variables and data structures. Emphasize that the goal is to catch logical errors and off-by-one mistakes before coding, and that you should verbalize each step to ensure your mental model matches the actual behavior.

Pro tip: Choose an input that exercises edge cases (e.g., empty, single element, duplicates) and narrate every state change aloud—this often reveals hidden assumptions. Also, compare the dry run output with the expected output to confirm correctness.

1. Select a representative test case

Pick a small input that covers typical cases and at least one edge case (e.g., empty, minimal size, or boundary values). This ensures your dry run tests both normal and tricky scenarios.

2. Simulate execution step-by-step

Walk through the algorithm line by line, maintaining a table of variable values and data structure states after each operation. Verbally describe what each line does and why.

3. Track and verify state changes

After each step, check that the state matches your expectations. Pay special attention to loop indices, pointer movements, and condition evaluations to catch off-by-one errors.

4. Compare with expected output

At the end, compare the final state or returned value with the known correct output for the test case. If they differ, identify the first step where divergence occurred.

5. Debug and refine

If the dry run fails, adjust your algorithm or assumptions and repeat the dry run with the same or a new test case until it passes.

Key Points to Mention

  • Dry run is a manual debugging technique to validate logic before coding.
  • Use small, representative inputs including edge cases to uncover hidden bugs.
  • Maintain a table of variable states to track changes accurately.
  • Verbalize each step to align mental model with actual execution.
  • Compare intermediate and final results with expected outcomes.
  • Iterate on the algorithm based on dry run findings.

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