Problem 2671. Check if vertices form a rectangle

Created by Matthew Eicholtz in Community

Given a set of 4 vertices defined by vectors X and Y, return true if the vertices form a rectangle and false otherwise.

X and Y are not necessarily in sorted order, but you may assume that X(i) is paired with Y(i).

Also, if computing distances in your solution (e.g. with pdist), it is recommended that you round to three decimal places.

Solution Stats

20.15% Correct | 79.85% Incorrect
Last solution submitted on Jun 29, 2018

Problem Comments

Solution Comments