Комментарии:
Thank you for this video Sir.
Just in first if operator it will be
if(v1 <= v2)
return "NO"
Just so you know, u have all the code correct except for a little mistake in the first if operator in your code. It should be <= because input might depict v2=v1
ОтветитьEasy explanations, Thank you for your effort. I subscribed Nikhil!
Ответитьhow (4,5,2,3) works can any one explain.. whether kangaro jumping backward
Ответитьrelative velocity is also a way
Ответитьbro its not working in python
here is my code:
x1,v1,x2,v2=map(int,input().split())
if(v1 < v2):
print("NO")
if((x2-x1)%(v1-v2)==0):
print("YES")
else:
print("NO")
if(v2 >= v1){
return "NO";
}
if((x2-x1)%(v1-v2) == 0){
return "YES";
}else{
return "NO";
}
velocity should not be equal check this
👍
Ответитьwhat to do when you are stuck ??
ОтветитьThanks for the easy explanation, but there is a situation where this code will not function.
given these parameters: (43 2 70 2)
The answer should be "NO", but your code return "YES"
MY ANSWER BASED ON YOUR SOLUTION IS:
- The first if statement should be like this: if(v1<= v2): return "NO"
The rest is fine.
Thank you sir!!
One of the greatest explanation given by any teacher.
we had to put a if case for v2>v1, meaning the formula would work if V2>v1, giving an integer, but why does this scenario bypass the formula ?
Ответитьsolution is wrong if v1==v2 the denominator becomes 0 it will raise an error
ОтветитьI was able to crack only problem is based on the number of jumps should match not that one will stay and other will it reach just with multiple jumps
ОтветитьGood job man!
Ответитьone error in this solution,instead of only applying if(v1<v2) we should apply (v1<=v2 ) because kangaroo 1 is always behind kangaroo 2 and cant meet even if v1==v2 and can also cause divided by zero exception according to solution
Ответитьif(v1<=v2) return "NO";
instead of if(v1<v2)
Test case: 43 2 70 2 to test
we know that kangaroo2 starting position is higher so if v2 >= v1 then its obvs "NO"
Ответитьbut j is already an int type just like all other variables then obviously the division will have truncated value not like 3.54 or 6.7
ОтветитьWow......what a clear explanation. Thanks
ОтветитьGood explanation, bro. Thank you
Ответитьthankyou sir for the explanation.. i was worried that i am not able to understand a simple problem.. but now i get it.. BTW you look alike Techno Gamerz xD
Ответитьlove your explanation! keep it up!
ОтветитьI tried this and it failed several test cases
ОтветитьWhy that formula gives a remainder of zero then only we reach at our amswer
Ответитьplease try to speak a little louder
Ответитьwhat if v1 = v2 then formula won't work
ОтветитьYour method is very useful and easily understood.
Ответить