Skip to content

Commit

Permalink
Q1232 added.
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Mar 11, 2023
1 parent 28d835b commit 34b3a41
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions E_1232_CheckIfItIsaStraightLine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Solution {
public boolean checkStraightLine(int[][] coordinates) {
int dx=coordinates[1][0]-coordinates[0][0];
int dy=coordinates[1][1]-coordinates[0][1];
for(int[] point: coordinates){
int x=point[0];
int y=point[1];
if(dy*(x-coordinates[1][0])!=(y-coordinates[1][1])*dx)
return false;
}
return true;
}
}

0 comments on commit 34b3a41

Please sign in to comment.