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

g1901_2000.s1952_three_divisors.Solution.kt Maven / Gradle / Ivy

There is a newer version: 1.28
Show newest version
package g1901_2000.s1952_three_divisors

// #Easy #Math #2023_06_21_Time_141_ms_(33.33%)_Space_32.8_MB_(100.00%)

class Solution {
    fun isThree(n: Int): Boolean {
        var divisors = 0
        for (i in 1..n) {
            if (n % i == 0) {
                divisors++
            }
        }
        return divisors == 3
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy