Algorithm · Netflix · Medium
Problem: DFS — Report Every Node’s Depth and Balance Status You are given a tree whose root is root. Although the tree will usually be binary, use the interviewer-provided definition when dealing with an N-ary tree. Visit the tree and produce the following information for every node: level: its depth, where the root has level 0 isBalanced: whether that node qualifies as balanced A node qualifies as balanced when the heights of its left and right subtrees differ by no more…
Checking your access…