Mirror tree problem

https://practice.geeksforgeeks.org/problems/mirror-tree/1

why isnt my code giving correct output

Hello @gulatigarvita08 do in this way:

but why to swap elements

@gulatigarvita08 because you have to form the mirror of the given binary tree.
so i think this must be the way of doing.