← Questions

Vectorized nearest-neighbour classifier as a linear layer

0
OpenAIMetaCodingLast asked Oct 2026

A coding interview question asked in OpenAI's agentic coding (beta) round and at Meta, last asked Oct 2026. It tests numpy, vectorization and machine learning.

Implement a 1-nearest-neighbour classifier in NumPy with no Python loops: each test point gets the label of the closest training point by Euclidean distance. Then show that the same classifier is the forward pass of a single linear layer…

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • OpenAI · Agentic coding (beta) · Last asked Oct 2026An existing codebase and changes too large to write by hand; you work through them with an AI coding agent · An AI coding agent is expected
  • Meta · Technical phone screen · Last asked May 202645 min · Two coding problems in CoderPad, about 20 minutes each · Usually no AI; some newer screens are AI-assisted

What it tests

numpy · vectorization · machine learning

Your code and the AI tutor open when you unlock this question.