Algorithm · Uber · Medium
A rooted ordered N-ary tree is provided via its root node. Every node stores an integer val and a list children of its child nodes, ordered from left to right; a node may have zero children. Group nodes by depth, with the root at depth 0 and each child one level deeper than its parent. For a depth d, define L_d as the first node encountered at that depth when scanning the tree level by level from left to right, and R_d as the last node encountered at that depth. The outer…
Checking your access…