← All problemsSign in

Quantisation

Colour quantisation is the problem of reducing the number of colours in an image. You are given a set k colours and a list of N colours (one for each point in the image). The problem is to replace each colour in N with the nearest colour in k. Each colour is a 3D vector of unsigned integers between 0 and 255. Make your algorithm efficient. See how far you are from the timings given below for the

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start