In this problem is it necessary to apply all given operations type? because we can simply find the result of given input and output the XOR of (result,n) . For example: 3 | 3 ^ 2 | 1 result of operations is 1 ,so to get 1 we can have 3^2, so output : 1 ^ 2 am I missing something?