Closest Pair of Points

You are given a flat array of integers that encodes a set of points in the plane. Consecutive values form one point: [x1, y1, x2, y2, ...]. The array always contains an even number of values, so every coordinate pair is complete.

Return the minimum squared Euclidean distance between any two of the points. For two points (x1, y1) and (x2, y2) the squared distance is (x1 - x2)^2 + (y1 - y2)^2. Squared distance is requested because it keeps every comparison exact in integer arithmetic and avoids a square root.

The function signature is solve(arg1), where arg1 is the flat coordinate array. If there are fewer than two points, return 0. If two points share the same coordinates, their distance is 0, which is the smallest possible answer.

Examples
Input: [0,0,3,4]
Output: 25
Hints

Closest Pair of Points

You are given a flat array of integers that encodes a set of points in the plane. Consecutive values form one point: `[x1, y1, x2, y2, ...]`. The array always contains an even number of values, so every coordinate pair is complete.