ERROR in get_slope() function, if x values are same, then we should return greater than 20k as discussed in video. It was missed out while writing the code. Here is the corrected code: get_slope( p1, p2){ if(p1[0] == p2[0]) return 40000;
Great work!!!!! Just a minor error...you forgot to check for if y are equal... that is->if(p1[0]==p2[0]||p1[1]==p2[1]){ return 1000000000000; line 14 correction..Great content!!!
Can anyone explain me the purpose of taking the very large number when the divisor become 0. It solve the problem, but how does it solve the problem, I am not much clear about it.
ERROR in get_slope() function, if x values are same, then we should return greater than 20k as discussed in video. It was missed out while writing the code. Here is the corrected code:
get_slope( p1, p2){
if(p1[0] == p2[0])
return 40000;
Thank you sir for your videos. I follow it regularly. Your explanation is very easy to understand the problem. All the best.
Regards
Sanghita
Thanks Sanghita.
Thanks dude!!
Welcome.
Great work!!!!! Just a minor error...you forgot to check for if y are equal... that is->if(p1[0]==p2[0]||p1[1]==p2[1]){
return 1000000000000; line 14 correction..Great content!!!
Oh. I see the error now... For same x it should be > 20k.
Thanks.
float get_slope(vector& p1, vector& p2){
if(p1[0] == p2[0])
return 40000;
return (float)(p2[1] - p1[1])/(p2[0] - p1[0]);
}
Added the CORRECTION in video description and comments section. That was a miss...
Why do you want to check if y is equal?
Hi brother, im just a beginner in java what are the steps i have ro follow leetcode problems
Plz explain sir.
Get familiar with basic data structures- Arrays, Linked List, Has Map, Trees, etc..
Can anyone explain me the purpose of taking the very large number when the divisor become 0. It solve the problem, but how does it solve the problem, I am not much clear about it.