need help in FLIPCOIN segment tree problem on CODECHEF

Can someone tell me what is wrong in my implementation of lazy propagation in this [PROBLEM][1]. If my lazy node is 1 then that segment needs to be flipped and if 0 then no change. I am just able to pass sample test case.
Someone please help:)



#HERE is your accepted solution…

Your bug is


Should be

lazy[node*2]=! lazy[node*2]);
lazy[node*2+1]=! lazy[node*2+1];


@l_returns Thanks for the help. Sorry for the delay. Can you please suggest some problems on segment tree to practice from basic to intermediate level :slight_smile:

You are welcome :slight_smile:
You need questions on lazy propagation or simply on segment tree ?

simply on segment tree would be great sir