MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / kangaroo

Function kangaroo

Hackerrank_problems/kangaroo/solution4.py:8–18  ·  view source on GitHub ↗
(x1, v1, x2, v2)

Source from the content-addressed store, hash-verified

6 The second condition is where we equate x1 + v1*t = x2 + v2*t. as the time should be greater then 0, the resulting condition is (x1-x2)/(v2-v1) > 0
7"""
8def kangaroo(x1, v1, x2, v2):
9 if v1==v2:
10 return "NO"
11 if (x1-x2)/(v2-v1)>0:
12 var=float(x1-x2)/float(v2-v1)
13 if var - int(var) ==0:
14 return "YES"
15 else:
16 return "NO"
17 else:
18 return "NO"
19
20if __name__ == '__main__':
21 fptr = open(os.environ['OUTPUT_PATH'], 'w')

Callers 1

solution4.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected