Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

int bulbSwitch(int n) { return sqrt(n+0.5); }

sqrt(n) will also solve. Why sqrt(n+0.5)

Yeah,u r right. I'm just not sure about the float deviation. so sqrt(n) works and sqrt(n+0.5) always works!

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.