Apple interview question

invert the binary tree with the most optimal solution