← ALL NOTES
Hash Table

865. Smallest Subtree with all the Deepest Nodes

Find the smallest subtree containing every deepest node of a binary tree. That target node is exactly the lowest common ancestor of all the deepest leaves, and the elegant realisation is you can…

Loading…