If current node is leaf
if not root . left and not root . right : NEW_LINE INDENT if root . val == arr [ index ] and index == n - 1 : NEW_LINE INDENT return True NEW_LINE DEDENT return False NEW_LINE DEDENT