Google | OA | Tree Value | Coding question
Google · Question · Posted Apr 2026
Question 1 Max. score: 30.00 Tree value You are given an undirected tree with N nodes rooted at node 1. Every node is assigned a value given by array A of N elements, i.e., the value of the i^{th} node is equal to A[i]. Given an integer K, you can perform the given operation at most K times. In each operation: Disconnect any leaf node and reconnect it to any vertex in the tree (including the vertex to which the ...
The full answer & interview discussion are available to premium members.
Log in Create a free account