What if the given tree could be any binary tree? Would your previous solution still work?

You may only use constant extra space.