NumPy allowed · plain Python earns 10 bonus points
Find the lowest common ancestor of two nodes in an arbitrary binary tree without BST ordering guarantees.
Implement lowest_common_ancestor_bt(root, p, q): perform a bottom-up postorder traversal. If a node matches p or q, return it. If both left and right recursive calls return non-null nodes, the current node is the LCA.
lowest_common_ancestor_bt(root: dict, p: int, q: int) -> int