
isSquare
You are given Cartesian coordinates of 4 different points. Determine if there exists a square with those 4 points as vertices.
Note: In the input arrays, (x[i], y[i]) represents the i-th point for i=0, 1, 2, 3.
Example
- For
x =
[-1, -1, 3, 3]
,y = [0, 4, 0, 4]
, the output should beisSquare(x, y) = True
Input/Output
-
[execution time limit] 1 second
-
[input] array.integer x
The x coordinates of the points
x.length = 4
-
[input] array.integer y
The y coordinates of the points
y.length = 4
-
[output] string
True if there is such square with the given 4 points as vertices,
False otherwise
Post Comment