Is a sequence a subsequence of a tree's in-order traversal?
Given a binary tree and a sequence of numbers, decide whether the sequence appears, in order, within the tree's in-order traversal (not necessarily next to each other). Walk the tree in order and advance a pointer in the sequence on each match. Then do it with no extra space, using Morris traversal. Follow-up: when it is not a subsequence, change the tree as little as possible so that it is.
No answer yet. Write the first one; the best answer gets endorsed.
