RepostedGoogle logo

Google · Phone screen

In process

Google New Grad R1 Valid Tree From Parent Array: 1 Experience

Software engineer · New GradMaster's degreeFeb 2026
Shared by

Google new grad SWE R1, February 2026: decide whether a parent array forms one valid tree, checking root count, cycles and reachability; passed.

At a glance

Coverage: one Google software engineer new grad candidate; report February 2026.

What came up

Topic Reports Last seen
Trees and graph traversal 1 of 1 Feb 2026

Questions we found

Algorithms / Data Structures

Question Reports Last seen
Validate a Tree From Its Parent Array 1 Feb 2026

1 detailed candidate timeline

01: One root, no repeats, everything reached

Report date: February 2026 · Role: Software Engineer, New Grad · Result: passed R1

Coding

  1. An array gives each node's parent. Decide whether these links form one valid tree: Validate a Tree From Its Parent Array.
  2. The candidate's checks: exactly one root; every other node has one parent, so n - 1 edges; every node reachable from the root; no node visited twice, which rules out cycles and extra paths.
  3. They built an adjacency list and counted roots, rejecting anything other than one. Then they traversed from the root with a visited array: a repeat visit meant invalid, and so did any node left unvisited.
  4. A reader asked whether "no cycle" meant directed or undirected; the candidate did not clarify.

Common questions

How do you check a Google parent-array tree is valid?

Report 01 required exactly one root, then traversed from it, failing on any repeat visit or unvisited node.

Keep practicing

Sources: Anywhere useful interview info can be found.

0 total reactions. Your reactions: none.
0 comments

Comments

0

No comments yet — be the first to share what you know.