• + 0 comments
    func kangaroo(x1 int32, v1 int32, x2 int32, v2 int32) string {
        // Write your code here
    		// k1 = x1 + m.v1
    		// k2 = x2 + m.v2
    		// if k1 = k2 then m > 0 and m is an integer
        numberOfJump := float32(x2 - x1) / float32(v1 - v2)
        if numberOfJump > 0 && numberOfJump - float32(int32(numberOfJump)) == 0 {
            return "YES"
        }
        
        return "NO"
    }