Closest Points in 2D Array

You are given a two dimensional array containing arrays of integer pairs, representing points. Return a two dimensional array containing the two points that are closest to each other.

Requirements

  • Must return a two dimensional array containing two arrays of points
  • Must also be able to handle negative points

Example #1

solve([[0,0], [1, 1], [100, 200], [450, 0]])
> [[0,0], [1,1]]

Example #2

solve([[-5, -1], [0,0], [35, 36], [35, 0]])
> [[-2, -1], [0,0]]