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
{
"l": 3,
"r": 7
}
Execution steps
Compute prefix XOR at both boundaries
Computed output
3
JavaScript reference implementation
const solve = ({
l,r
},s)=>{
const f=n=>n%4===0?n:n%4===1?1:n%4===2?n+1:0;
let a=f(l-1),b=f(r);
s("Compute prefix XOR at both boundaries",{
Prefix:[a,b]
});
return a^b
};