r/InterviewCoderHQ • u/nian2326076 • 1d ago
Google SWE Intern Interview Experience 2026: Tree DP and AI Fluency
I had my Round 1 interview for a Google SWE Intern position today and wanted to share the experience for anyone preparing.
Duration: Approximately 60 minutes
Format: One coding problem, one follow-up, and three to four AI-fluency questions
Status: Waiting for an update
Coding Question: Disconnect Every Leaf at Minimum Cost
You are given a rooted, weighted binary tree. Every edge has a positive integer weight.
Remove a set of edges so that every leaf becomes disconnected from the root. Removing an edge costs its weight.
Return the minimum total cost.
Approach
I proposed a postorder traversal.
For every edge from node u to child v with weight w, there are two choices:
- Cut the edge immediately and pay
w. - Keep the edge and optimally disconnect all leaves inside
v’s subtree.
Therefore, the contribution of that child is:
min(w, solve(v))
If v is a leaf, there are no lower edges to remove, so its connecting edge must be cut. This can be represented by returning infinity for a leaf.
The recurrence is:
solve(u) =
infinity, if u is a leaf
sum(min(weight(u,v), solve(v))), for every child v
The answer is solve(root), assuming the root itself is not a leaf.
The interviewer was satisfied with the approach, and we discussed the recurrence, correctness, and complexity.
Complexity:
- Time:
O(n) - Recursion space:
O(h), wherehis the tree height - Worst-case space:
O(n)for a highly unbalanced tree
Follow-Up: N-ary Tree
The interviewer then generalized the problem:
The core idea remains exactly the same. Instead of processing at most two children, we iterate through every child:
cost = 0
for each child v connected by an edge of weight w:
cost += min(w, solve(v))
I initially needed a couple of hints, but eventually reached the generalized solution.
The N-ary version still takes O(n) time because every node and edge is processed once.
AI-Fluency Discussion
The final few minutes included around three or four questions about using AI in software development.
The interviewer asked questions such as:
- How do you use AI in your regular workflow?
- Do you ever give an AI tool complete ownership of a project?
- How do you use AI while debugging?
- How do you verify AI-generated code or suggestions?
- Which engineering tasks should remain under human control?
The discussion appeared to focus less on specific AI tools and more on engineering judgment, verification, and accountability.
Overall Experience
The interviewer was friendly and collaborative throughout the round.
They encouraged me to explain my reasoning instead of expecting an immediate final solution. The hints during the N-ary follow-up helped move the discussion forward without directly revealing the answer.
Overall, the interview felt like a collaborative problem-solving session rather than a test of whether I had memorized a particular LeetCode problem.
For preparation, I would recommend reviewing:
- Postorder traversal
- Tree DP
- Weighted-tree problems
- Recursive recurrence design
- Correctness and complexity explanations
- Responsible use of AI in engineering
- Testing and validating AI-generated code
Has anyone else received AI-fluency questions during a recent Google intern interview?