Problem with one test case. I think the expected line is wrong.
@leet444 If the
input you've listed denotes values, the
expected line is correct.
If we make the following variable substitution:
input = [2, 1, 4, 3, 6, 5, 7, 8]
input = [A, B, C, D, E, F, G, H]
[A, C, E, G, B, D, F, H], since we're linking every "odd" element, followed by every "even" element.
As the Problem Statement notes:
The first node is considered odd, the second node even and so on ...
If we reverse the substitutions above, we arrive at an
[A=2, C=4, E=6, G=7, B=1, D=3, F=5, H=8].