Reposted
Google · Onsite
In processGoogle Early Career R1: Cheapest Common Ancestor and Project Discussion
Software engineer · New GradMaster's degreeJan 2026
Shared by
Role: Software Engineer, Early Career
Result: Final outcome not disclosed
Report time: January 2026
Behavioral and project discussion
The interviewer asked about a recent project that was both challenging and interesting, then followed up on the problems the candidate encountered.
Coding: cheapest common ancestor
Every node in a tree has a price and references to its parent and children. Given two different nodes, find the lowest-priced node among all of their common ancestors.
The candidate:
- Discussed a brute-force approach.
- Defined the
TreeNodeclass needed by the solution. - Implemented the base solution.
- Analyzed time complexity.
- Dry-ran an example.
- Proposed test cases and edge cases.
- Discussed ideas and complexity for an optimal solution when time ran out.
Practice: Cheapest Common Ancestor
The source does not preserve the exact tree-root guarantee or tie rule beyond the canonical practice assumptions documented on FastPrep.
0 total reactions. Your reactions: none.
0 comments
Comments
0No comments yet — be the first to share what you know.