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

google logo
google
Software Development InternOngoing
October 29, 202521 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.

Full Experience

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.

Interview Questions (2)

Q1
Binary Tree Operations: Reciprocal, Swap Children, and Mode-based Subtree Removal
Data Structures & AlgorithmsHard

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.

Q2
Implement Swap Function for Two Numbers
OtherEasy

How would you implement a function to swap two numbers?

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

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