Leetcode Note: Go - Three Divisors

Three Divisors - LeetCode
https://leetcode.com/problems/three-divisors/

  • Go 言語で取り組んだメモ

回答

Simple and fast solution in Go - Three Divisors - LeetCode
https://leetcode.com/problems/three-divisors/solutions/2938511/simple-and-fast-solution-in-go/

func isThree(n int) bool {

    if len(div(n))==3{
        return true
    }
    return false
    
}


func div(n int)[]int{
    var res []int

    for i:=1;i<=n;i++{
        if n%i==0{
            res=append(res,i)

        }
    }
    return res
}