I am having trouble understanding what the question exactly asks. Should we swap parent and child too? As long as the output is a valid BST isn't that enough ?
Here is what I get.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.