NumPy allowed · plain Python earns 10 bonus points
Cosine-like similarity scores ranked before context assembly
Implement the exact ("flat") k-NN search every ANN index (HNSW, IVF, LSH) is an approximation of -- the ground-truth baseline used to measure the recall of every faster index structure.
Implement brute_force_knn(query, vectors, k): compute the Euclidean distance from query to every row in vectors, and return the indices of the k nearest, sorted nearest-first (ties broken by ascending index).
brute_force_knn(query: list[float], vectors: list[list[float]], k: int) -> list[int]