google logo
Google· Software Development Intern

Google Software Development Intern 2026, Round-1(Question & Answer)

Result
Ongoing
Posted
29 Oct 2025
399 reads

Summary

I had my first round interview for a Software Development Intern position at Google. I was given a complex Binary Tree problem involving node value manipulation, node swapping, and subtree removal based on the mode. I successfully solved it, achieving O(n) time and space complexity, and also discussed a follow-up question on swapping two numbers.

How it went

I recently had my first-round interview for the Software Development Intern position at Google. The interview lasted 45 minutes. I was presented with a challenging Binary Tree problem that required me to implement several operations. First, I needed to replace each node's value with its reciprocal. Second, I had to swap the left and right children of each node (not their values). Finally, if a node's value was the arithmetic mode (the most repeated value in the entire tree), I had to remove that node and its entire subtree.

I managed to solve the problem efficiently, achieving O(n) time and space complexity by using a map for frequency counting and then traversing the tree to apply the transformations and removals. My solution involved a helper function to count frequencies and another to perform the transformations recursively.

The interviewer also asked a follow-up question on how to implement a function to swap two numbers.

Questions asked (2)

  1. 01

    Binary Tree Operations: Reciprocal, Swap Children, and Mode-based Subtree Removal

    Data Structures & Algorithms · Hard

    Given a Binary Tree where all nodes have float64 values, implement the following operations:

    1. Replace each node's value with its reciprocal.
    2. Swap the left and right children of each node (not their values).
    3. If a node's value is the arithmetic mode (the most repeated value in the entire tree), remove that node and its entire subtree.

    The solution should handle basic constraints and consider non-zero division for reciprocals.

  2. 02

    Implement Swap Function for Two Numbers

    Other · Easy

    How would you implement a function to swap two numbers?

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Google recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!