Mark As Completed Discussion

That final row is currently directionally 4 -> 5 -> 3, but we'd want the outcome to be 3 -> 5 -> 4 to be properly inverted.

However, we can achieve this by doing two separate swaps. Notice that the below is what we'd get if we swapped 4 and 5 to obtain 5 -> 4, and then swapping 5 -> 4 with 3.

Step Five
SNIPPET
1      1
2     / \
3    2   3
4   /   / \
5  3   5   4