At Meta, a tree-shaped structure may need to be aggregated by vertical alignment rather than by level. Given the root of a binary tree, return the sum of node values in each vertical column from leftmost column to rightmost column.
A node's column index is defined relative to the root:
0c is in column c - 1c is in column c + 1Implement a function:
root, the root node of a binary tree, represented as nested dictionaries or objects with fields val, left, and right, or null for an empty tree0 <= number of nodes <= 10^5-10^4 <= node.val <= 10^4root may be nulldef vertical_column_sums(root):