The problem asks to toggle bits in a given range that after certain operations all bits becomes 0 .
My O(N2) solution is for a given light bulb if it is on the switch it off and update all the given ranges , but this will be N^2 complexity . How can we reduce it to O(n) . The last lines of the editorial i couldn't understood , how the author is updating the ranges .
how to do it . ?