3 ms·
You can find the problem described here. It also has a link to solutions in different languages. https://leetcode.com/problems/invert-binary-tree/ https://lee
by Mc91 2y ago
You can find the problem described here. It also has a link to solutions in different languages.
https://leetcode.com/problems/invert-binary-tree/ https://leetcode.com/problems/invert-binary-tree/
- bdowling 2y agoSo, inverting is just swapping the left and right pointers for the entire tree? Why would you ever do that? That will flip the ordering of the tree and none of your search or balancing functions will work anymore. Shut up! Don't ask questions! Uh, ok.
- hardlianotion 2y agoOh thanks - I forgot I asked this! So an efficient way to invert would be to abstract out the ordering relation and make it swappable.