All Tracks Math Number Theory Basic Number Theory-1 Problem

Help Santa
Tag(s):

Easy-Medium

Problem
Editorial
Analytics

Santa has arrived.He tells you that due to demonetization there is a shortage of gifts.So he asks to find some standard gifts for him.A gift is a stantard gift if its 4 endpoints on a Cartesian plane form a square.So given the end points Return true if these points form a square, and false otherwise.

SAMPLE INPUT
0 0 0 3 3 3 3 0
SAMPLE OUTPUT
true
Explanation

For input:0 0 0 3 3 3 3 0 the output should be true

Here's what figure the points form:

. enter image description here

Input/Output

[time limit]:250 s [input] array.integer points

Input is 8 integers. It is guaranteed that all points are unique.

Note, that the points can be given in random order.

Constraints: points.length = 8, -105 ≤ points ≤ 105.

[output] boolean

true if the given points form a square, false otherwise.

Time Limit: 2.5 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic, Kotlin

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications