Problem
Ask
Submissions

Problem: Valid Square

Medium
30 min
Explore how to determine if four points in a plane form a valid square by checking the equality of side lengths and the presence of right angles. Understand the geometric constraints and implement solutions confidently.

Statement

Given the coordinates of four points P1P_1, P2P_2, P3P_3, and P4P_4 in 2D space, determine if these points form a square.

Each point PiP_i is represented as [xi, yi][x_i,\space y_i], and the points may be provided in any order.

A square is defined as having:

  • Four sides of equal positive length

  • Four right angles (90 degrees)

Constraints:

  • p1.length == p2.length == p3.length == p4.length == 2

  • 104-10^4\leq xi, yix_i, \space y_i 104\leq 10^4

Problem
Ask
Submissions

Problem: Valid Square

Medium
30 min
Explore how to determine if four points in a plane form a valid square by checking the equality of side lengths and the presence of right angles. Understand the geometric constraints and implement solutions confidently.

Statement

Given the coordinates of four points P1P_1, P2P_2, P3P_3, and P4P_4 in 2D space, determine if these points form a square.

Each point PiP_i is represented as [xi, yi][x_i,\space y_i], and the points may be provided in any order.

A square is defined as having:

  • Four sides of equal positive length

  • Four right angles (90 degrees)

Constraints:

  • p1.length == p2.length == p3.length == p4.length == 2

  • 104-10^4\leq xi, yix_i, \space y_i 104\leq 10^4