I know we have to do lazy range updates,I have seen code in discussion but i didn’t get what is the logic exactly used for integer formed
This is the question:-
You are given an n-bit integer (initially 0). There are Q queries. Each query is of following type:
0 L R: Set all the bits from Lth bit to Rth bit to zero.
1 L R: Set all the bits from Lth bit to Rth bit to one.
2 L R: Find the integer formed by the bits in range [L, R]. Answer all the queries of type 2. Indexing is 0-based. See the sample test case for clarity.