There is a pattern in consecutive numbers xor.
It’s explained really well here.
And after that, you can use binary search(upper or lower bound) to find the starting and ending consecutive range of 0’s.
I used two set’s for it, one for positions of 1 and other for positions of houses which are still 0 and in neighbourhood of 1.