Doubt with subsets values in December challenge problem XORSUB..

I am sorry if anyone feel this thread violates the rules & regulations of on-going contest and he/she may remove this thread.

Problem Link : CodeChef: Practical coding for everyone

I am unable to understand the concept of subsets and in problem XORSUB from December Challenge.

F({}) = 0

F({1}) = 1

F({1,2}) = 3

F({1,3}) = 2

F({1,2,3}) = 0

F({2}) = 2

F({2,3}) = 1

F({3}) = 3

As this is given in problem explanation part, i an unable to understand how to derive the values of F(P).

Please help!!

subsets of {1,2,3} are {},{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}
suppose i taken {1,2} => then xor operation between those 2 elements i.e 1^2 = 3
if i take {1,2,3} => 1^2^3 =0.
you will get 8 values.
you have to get the maximum number that obtained by the above operation with k

2 Likes

Thanks @asif_mohammed:slight_smile: