You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are given a rooted binary tree. In this binary tree, all the right nodes are either a leaf node with a sibling (left node sharing the same parent node) or empty.
Your task is to flip this tree upside down such that all right nodes turn into left leaf nodes.
You are given the 'ROOT' of the binary tree. Your task is to return the new 'ROOT' after turning the tree upside down.