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
{
"x": 13,
"i": 2,
"op": "toggle"
}
Execution steps
Create bit mask
Apply toggle
Computed output
9
JavaScript reference implementation
const solve = ({
x,i,op
},s)=>{
let mask=1<<i,v=op==="check"?(x>>i)&1:op==="set"?x|mask:op==="clear"?x&~mask:x^mask;
s("Create bit mask",{
Input:[...x.toString(2)],Mask:[...mask.toString(2).padStart(4,"0")]
});
s("Apply "+op,{
Result:[...v.toString(2)]
});
return v
};