I have got an O(N^2) solution. Came youtube if any one explaining any more optimal solution. And find your O(N^3) solution. Please man, at least do some research and explain the most optimal one. As leetcode is not for just solving a problem.
after two loops, we have to put condition like if(i!=j){ }; because points should not be same, for same points we will get 0==0 and total will increase; ans will be wrong
sir can you expalin how can you write the y2-y2 * x3-x1 == y3-y1*x2-x1 in the form of point. I am not able to understand these line. Plzzzzzzzzzzzzzzzzzz help
Not satisfied with the solution first he tell we need to check (y2-y1)/(x2-x1)=(y3-y1)/(x3-x1) now in code is is checking condition p[j][1]-p[i][1])*(p[i][0]-p[k][0])==(p[i][1]-p[k][1])*(p[j][0]-p[i][0]) but it should we p[j][1]-p[i][1])*(p[k][0]-p[i][0])==(p[k][1]-p[i][1])*(p[j][0]-p[i][0])
I have got an O(N^2) solution. Came youtube if any one explaining any more optimal solution. And find your O(N^3) solution. Please man, at least do some research and explain the most optimal one. As leetcode is not for just solving a problem.
2 parallel lines have the same slopes
yes
thanks for the solution, could you please solve leetcode problem 2244 and make a video on it explaining it.
after two loops, we have to put condition like if(i!=j){
};
because points should not be same, for same points we will get 0==0 and total will increase;
ans will be wrong
can we iterate k from j+1 to n-1, as we are iterating k from 0 to n-1 so we taking some points again??
bro which dark theme you are using?
can you make video on
leetcode 391 perfect rectangle
If condition isn't needed. I have done it without condition and got accepted
Very Good
Bro O(N^2) is also possible for this one.
yes
@@codeExplainer then make a video on optimized solution
The solution is wrong as you are not checking for the constant in a line
sir can you expalin how can you write the y2-y2 * x3-x1 == y3-y1*x2-x1 in the form of point. I am not able to understand these line. Plzzzzzzzzzzzzzzzzzz help
consider a 2d matrix then you will understand
thanks for nice and clear explanation
You are welcome
Code link expired
Hard level questions are must to do crack coding interviews as fresher?
no as a fresher you should be able to atleast solve easy level . if you are able to solve mid and hard level then its nice
@@harishreeln4706 thanks to solve my query all the best 👍
Not satisfied with the solution first he tell we need to check (y2-y1)/(x2-x1)=(y3-y1)/(x3-x1) now in code is is checking condition
p[j][1]-p[i][1])*(p[i][0]-p[k][0])==(p[i][1]-p[k][1])*(p[j][0]-p[i][0])
but it should we
p[j][1]-p[i][1])*(p[k][0]-p[i][0])==(p[k][1]-p[i][1])*(p[j][0]-p[i][0])
It can be both the ways bro. But if u go according to exact slope formula it should be the way u said
too much brute force solution.....
Nice 🎇
Thanks
This is brute force. Not useful!
Lol worst solution. You should atleast explain n^2 or n^2logn approach
did not like the explanation
will improve on it