How is x=1 y=2 and z=3 supposed to return false ?
That test case is failing my solution saying the answer is false, but clearly the answer for this input is true.
Wrong test case

Found the same issue while running tests. Should state this clearly in the description if it's not allowed to split the z liters into two jugs.
Eventually I submitted something like this:
public boolean canMeasureWater(int x, int y, int z) { if (z < 0) return false; if (z == 0) return true; // If at least one of the jugs were broken... if (x <= 0) return y == z; if (y <= 0) return x == z; // If measuring z with both jugs were permitted... //if (z > x + y) return false; // If z must be fitted into one single jug... if (z > (x > y ? x : y)) return false; return z % gcd(x, y) == 0; }

