Algorithm · Oracle · Medium
You are given the root of a binary tree. Compute its bottom view. For each distinct horizontal distance, keep only the node with the largest depth. If more than one node has both that maximum depth and the same horizontal distance, keep the one that is processed later by a left-to-right level-order traversal of the tree. The root has horizontal distance 0. For any node with horizontal distance d, its left child has horizontal distance d - 1 and its right child has horizontal…
Checking your access…