3 ms·
Yeah it's not clear what he was asked. Swapping the direction of every edge of a binary tree would result in a DAG that is likely no longer a binary tree though
by howling 4y ago
Yeah it's not clear what he was asked. Swapping the direction of every edge of a binary tree would result in a DAG that is likely no longer a binary tree though.
- gifnamething 4y agoAre you confusing a binary tree with something else? Here's an example: https://leetcode.com/problems/invert-binary-tree/ https://leetcode.com/problems/invert-binary-tree/ It's an 'easy' question. The solution is <10 lines.
- zeroonetwothree 4y agoYeah it's really easy. I wrote a correct solution in about 30 seconds on my first try. And I haven't actually practiced these problems for 10+ years.