Welcome to the Python screen.
The question is on your right: Lowest Common Ancestor in View Tree. Read through the requirements first.
Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?
In a Meta mobile UI hierarchy, each view is a node in a rooted tree. Given the root of the view tree and two target views, return their lowest common ancestor: the deepest view that is an ancestor of both targets.
If either target view does not exist in the tree, return None.
Implement a function:
root (root ViewNode), view1 (ViewNode), view2 (ViewNode)ViewNode representing the lowest common ancestor, or NoneEach node has:
id: unique integer identifierchildren: list of child ViewNode objectsdef lowest_common_ancestor_view(root, view1, view2):