All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g0301_0400.s0319_bulb_switcher.Solution Maven / Gradle / Ivy

There is a newer version: 1.24
Show newest version
package g0301_0400.s0319_bulb_switcher;

// #Medium #Math #Brainteaser #2022_07_08_Time_0_ms_(100.00%)_Space_41.1_MB_(27.19%)

public class Solution {
    public int bulbSwitch(int n) {
        if (n < 2) {
            return n;
        }
        return (int) Math.sqrt(n);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy