# Result for 25 test case

• My program only return 24 points while it should return 25 points. I cannot figure out which one is missing.
Here is the input:
{{40,-23},{9,138},{429,115},{50,-17},{-3,80},{-10,33},{5,-21},{-3,80},{-6,-65},{-18,26},
{-6,-65},{5,72},{0,77},{-9,86},{10,-2},{-8,85},{21,130},{18,-6},{-18,26},{-1,-15},
{10,-2},{8,69},{-4,63},{0,3},{-4,40},{-7,84},{-8,7},{30,154},{16,-5},{6,90},
{18,-6},{5,77},{-4,77},{7,-13},{-1,-45},{16,-5},{-9,86},{-16,11},{-7,84},{1,76},
{3,77},{10,67},{1,-37},{-10,-81},{4,-11},{-20,13},{-10,77},{6,-17},{-27,2},{-10,-81},
{10,-1},{-9,1},{-8,43},{2,2},{2,-21},{3,82},{8,-1},{10,-1},{-9,1},{-12,42},
{16,-5},{-5,-61},{20,-7},{9,-35},{10,6},{12,106},{5,-21},{-5,82},{6,71},{-15,34},
{-10,87},{-14,-12},{12,106},{-5,82},{-46,-45},{-4,63},{16,-5},{4,1},{-3,-53},{0,-17},
{9,98},{-18,26},{-9,86},{2,77},{-2,-49},{1,76},{-3,-38},{-8,7},{-17,-37},{5,72},
{10,-37},{-4,-57},{-3,-53},{3,74},{-3,-11},{-8,7},{1,88},{-12,42},{1,-37},{2,77},
{-6,77},{5,72},{-4,-57},{-18,-33},{-12,42},{-9,86},{2,77},{-8,77},{-3,77},{9,-42},
{16,41},{-29,-37},{0,-41},{-21,18},{-27,-34},{0,77},{3,74},{-7,-69},{-21,18},{27,146},
{-20,13},{21,130},{-6,-65},{14,-4},{0,3},{9,-5},{6,-29},{-2,73},{-1,-15},{1,76},
{-4,77},{6,-29}}
I can find index 4,11,12,13,15,21,25,36,38,39,41,67,68,70,73,82,85,89,93,101,105,115,116,129
Which on do I missing? I could understand if I have too many, maybe I missed one condition. But if I have less, means something does not satisfy the condition in my case.
Anyone tried this test case?

• Most likely there is a bug in your code. Are you comparing two floating points directly using the `==` sign?

• No, the comparing part should be fine. I dont use floating in my code, its all integer.
For start point a, i calculated the delta1 and delta2 for points b and c.

``````private boolean inStraightLine(int[] delta1, int[] delta2){
boolean result = false;
if( (delta1[0] == 0 && delta1[1] == 0) || (delta2[0] == 0 && delta2[1] == 0) ) {
result = true;
} else if(delta1[0] == 0 || delta2[0] == 0) {
result = delta1[0] == delta2[0];
} else if(delta1[1] == 0 || delta2[1] == 0) {
result = delta2[1] == delta1[1];
} else {
result = delta1[0]*delta2[1] == delta2[0]*delta1[1];
}
return result;
}
``````

Since I actually have LESS points then the expected result. So there is 1 points does not satisfy the my condition but somehow show in the result.

Could anyone post their result for my test case?

• Well, it's hard to know what's wrong without posting your solution. Do you mind updating your question with your solution?

• In your algorithm, all the case can be tested by `delta1[0]*delta2[1] == delta2[0]*delta1[1]`. You don't need to separate them

• I ran the test, and think it may missed No. 7 items.

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.