Back to problems

Solve tree view and parentheses cleanup

Algorithm · Meta · Medium

Problem 1 A binary tree is supplied in level-order form, where null represents a missing child. Imagine viewing this tree from the right side. At each depth, the visible node is the rightmost node that exists at that depth. Return the values of those visible nodes, ordered from the root down to the deepest visible level. Example 1: Explanation: At depth 1, 1 is visible; at depth 2, the rightmost node is 3; at depth 3, only 5 is visible. Example 2: Explanation: There are no…

Checking your access…