Company: London Stock Exchange Group(LSEG)_2Nov
Difficulty: medium
Points on Square Perimeter Problem Description You are given N two-dimensional points described by two arrays X and Y, both of N integers. The K-th point position is represented by the pair (X[K], Y[K]) - the respective X and Y coordinates of the point. Your task is to check if there exists a square, with its sides parallel to the OX/OY axes, such that all the given points lie on this square's perimeter. Write a function: bool solution(vector<int> &X, vector<int> &Y); that, given two arrays X and Y of N integers, returns true if all the points lie on the perimeter of some square, and false otherwise. Examples Example 1: Input: X = [-1, 1, 0], Y = [-2, 1, 0] Output: true Explanation: The points are (-1,-2), (1,1), (0,0). A square with sides parallel to the axes can be found such that all points lie on its perimeter. Example 2: Input: X = [-10, -10], Y = [-10, 10] Output: true Explanation: The points are (-10,-10) and (-10,10). These two points can lie on the perimete