problem link:https://www.hackerearth.com/practice/basic-programming/bit-manipulation/basics-of-bit-manipulation/practice-problems/algorithm/monk-and-binary-array-1/

didn’t get the qtn…

in the sample test,how is the output equal to 4??

can someone explain.

Given array is

1 0 0

After changing last 0 to 1 array becomes

1 0 1

Now there are 4 sub-arrays whose xor value is 1 and they are

{1}

{1,0}

{0,1}

{1}