Google 面试题 灯泡状态

You have a system with N light bulbs indexed from 0 to N1. The light bulbs are all in an OFF state. The system allows you to perform two operations: * boolean isOn(int index) return true if light bulb at given index is ON, false otherwise.
* void toggle(int start, int end) toggle all the light bulbs in the range [start, end] (inclusive). So if the light was ON in that range, flip it to OFF, and if it was OFF > to ON.

Implement the class that allows me to efficiently use the two given methods




interval tree入门题