Recently failed my Google Screening

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-03-06Added By Anonymous
Source:Ā Link
🧭 Experience: unknown
āœ… Outcome: Failed
šŸ’° Compensation: unknown
šŸ“ Location: unknown
šŸ¢ Company: Google
šŸŽ“ Education: unknown
šŸŽ Benefits: unknown
šŸ“… Offer Date: unknown

The question was :

you are given a undirected acyclic graph, each node in the graph can have at most 3 neighbors, find the node in the graph after setting that node a root, the graph will convert in to a binary tree.

I gave a solution but it was O(N^2).

can anyone help me with the solution
Comments