Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b5c1177

Browse files
committed
2020-03-21
1 parent 1e69cf0 commit b5c1177

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Solution(object):
2+
def canMeasureWater(self, x, y, z):
3+
"""
4+
:type x: int
5+
:type y: int
6+
:type z: int
7+
:rtype: bool
8+
"""
9+
if not z:
10+
return True
11+
if not x:
12+
return y == z
13+
if not y:
14+
return x == z
15+
if x + y < z:
16+
return False
17+
def gcd(a, b):
18+
while a % b:
19+
a, b = b, a % b
20+
return b
21+
return not z % gcd(x, y)

0 commit comments

Comments
 (0)