FunctionRacerProblemsRace

Valid Square

MediumMathPython, JavaScript, TypeScript, Java, C++

Four points [x, y] are given in any order. Return True if they are the corners of a square with positive side length, otherwise False.

Example 1

p1 [0,0]
p2 [1,1]
p3 [1,0]
p4 [0,1]
returns true

A unit square.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems