No one has replied
I just ran your code and found that the runtime is 220ms, were the test cases changed?
I had the same problem, just use preorder traverse and get the same error.
This problem wants to a method to invert the binary tree, not all of process including input, output.
your code could be cleaner
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.