Golang solution


  • 0
    R
    func canMeasureWater(x int, y int, z int) bool {
        if(x+y < z) {return false}
        if(x==z || y==z) {return true}
        return (z % gcd(x,y)) == 0
    }
    
    func gcd(a int, b int) int {
        if b == 0 {
            return a
        } else {
            return gcd(b, a%b)
        }
    }
    

Log in to reply
 

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