Print the bottom view of a binary tree.
Asked in the Virtual Round 1 (Coding Round) stage. First technical virtual round.
Represent each node as { "val": number, "left": node|null, "right": node|null }. Return values visible from the bottom, ordered from the leftmost to rightmost horizontal distance. If multiple nodes share a horizontal distance and depth, keep the node visited later from left to right.
Example: root [1,2,3,4,5,null,6] produces [4,2,5,3,6].
Constraints: Up to 10^4 nodes. Node values are integers.
def bottom_view(root):