Assign each point to its nearest centroid using squared Euclidean distance. A point equidistant from several centroids goes to the one with the lowest index.
Implement solve(X,C).
Returns. Return an integer NumPy array of length n_points with the index of the nearest centroid for each point.
Example 1
Input:
solve([[0.0, 0.0], [2.0, 2.0], [1.0, 1.0]], [[0.0, 0.0], [3.0, 3.0]])
Output:
[0, 1, 0]
Example 2
Input:
solve([[0.0], [1.0]], [[0.0], [1.0], [5.0]])
Output:
[0, 1]
No results yet
Run your code to check it against the examples, or submit to run every test.