Implement permutations and image retrieval
AppleMachine Learning Engineer · OnsiteLast updated
This question evaluates algorithmic implementation and computational thinking across combinatorics, image processing, and vector similarity—specifically testing permutation generation, 2D convolution with explicit boundary handling, and nearest-neighbor retrieval for image embeddings.
The coding portion included several short exercises for a vision-focused ML role:
- Given an array of distinct integers, return all possible permutations.
- Implement a basic grayscale image filter. The input is a 2D integer matrix and a fixed 3 x 3 kernel. Produce the filtered image using convolution, and state clearly how you handle boundary cells.
- Given a query image embedding and a gallery of image embeddings, return the index of the most similar image. You may use cosine similarity or Euclidean distance, but explain the complexity of your approach and how you would scale it beyond a brute-force scan.
Assume standard helper functions for vector math and valid input sizes.
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.