I am unable to understand one test case where x = 4, y =6 and z = 8. How come the expected output is True ?


  • 0
    A

    I think the output should be true only when x,y is relatively prime to each other. Can someone please help me understand why the test case (x, y, z) = (4,6,8) should return True instead of False?


  • 0

    (0,0) => (4,0) => (0,4) => (4,4)


  • 0
    A

    okay, thanks. I actually misunderstood the question where I thought only one of the jug should and not two containers combined contain z liters of water after the operation.


  • 0
    F

    Because you can sump up both jugs to reach the target....the traditional problem only allows one jug to match


Log in to reply
 

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