Given an input array of points to cluster: X (shape N x D) and cluster centers C (shape K x D). Return assignments of shape N, linking points to their nearest (L2) cluster.
Asked in the Technical round 2, coding stage. This is the assignment step of k-means, written with tensors. Avoid materializing the full [N, K, D] tensor; ties must choose the lowest center index.
Implement def assign_clusters(X, C):. X and C are non-empty nested lists of numbers with shapes N x D and K x D; return a list of N integer center indices.
def assign_clusters(X, C):