We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bcb5364 commit c15fa9eCopy full SHA for c15fa9e
my-submissions/e1232.py
@@ -0,0 +1,16 @@
1
+class Solution:
2
+ def checkStraightLine(self, coordinates: List[List[int]]) -> bool:
3
+ x, y = coordinates[0]
4
+ x2, y2 = coordinates[1]
5
+ if (x == x2 or y == y2) and (x != x2 or y != y2) :
6
+ if x == x2 :
7
+ return all(a == x2 for a, b in coordinates[2:])
8
+ else :
9
+ return all(b == y2 for a, b in coordinates[2:])
10
+
11
+ delta = (y2 - y) / (x2 - x)
12
13
+ try :
14
+ return not any((delta != (y2 - y) / (x2 - x)) for x2, y2 in coordinates[2:])
15
+ except ZeroDivisionError as zde :
16
+ return False
0 commit comments