Follow the computed execution on the reference input. Advance one step at a time, inspect the changing values and compare your prediction with the final output.
Example input
[
1,
2,
3,
4,
5
]
Execution steps
Append to positional chain
Computed output
[
1,
3,
5,
2,
4
]
JavaScript reference implementation
const solve = (a,s)=>{
let odd=[],even=[];
a.forEach((x,i)=>{
(i%2?even:odd).push(x);
s("Append to positional chain",{
Odd:odd,Even:even
})
});
return odd.concat(even)
};