Implementing solution to k-closest points problem