6 kyu

Do the points form a square?

308 of 338user6800471

Description:

You are given a list of four points (x, y). Each point is a tuple

Your task is to write a function which takes an array of points and returns whether they form a square.

If the array doesn't contain 4 points, return False.

All points coordinates are integers.

Squares can be rotated using a random degree.

Examples

((1,1), (3,3), (1,3), (3,1)) -> True
((0, 0), (0,2), (2,0), (2,1)) -> False
([]) -> False

Constraints:

1 <= x, y <= 1000

Note:

Performance does not enforced in this kata.

Fundamentals
Arrays

Stats:

CreatedNov 6, 2021
PublishedNov 6, 2021
Warriors Trained1038
Total Skips25
Total Code Submissions3048
Total Times Completed338
Python Completions308
C Completions33
Total Stars34
% of votes with a positive feedback rating90% of 97
Total "Very Satisfied" Votes80
Total "Somewhat Satisfied" Votes14
Total "Not Satisfied" Votes3
Total Rank Assessments26
Average Assessed Rank
6 kyu
Highest Assessed Rank
5 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • user6800471 Avatar
  • rowcased Avatar
  • cemsina Avatar
Ad