Company: Linkdin_2feb
Difficulty: medium
Closest Color Problem Description A pixel color RGB is defined as a 24 bit integer. Each 8 bit integer (1 byte) represents either red, green or blue color. Each 8 bit integer has an integer value between 0 (Low intensity) and 255 (High intensity). For the distance between two pixels having RGB values (r₁, g₁, b₁) and (r₂, g₂, b₂), it is calculated as follows: d = √((r₁ - r₂)² + (g₁ - g₂)² + (b₁ - b₂)² ) For reference, the RGB values for pure colors are defined as follows: Pure Color R G B Black 0 0 0 White 255 255 255 Red 255 0 0 Green 0 255 0 Blue 0 0 255 Given a 24-bit binary string describing a pixel, identify which of these five colors the pixel is closest to using the Euclidean distance calculation. Then return the closest pure color: Red, Green, Blue, Black, White. If there is more than one closest color, return Ambiguous. Function Description Complete the function closestColor in the editor below. closestColor has the following parameter(s): string pixels[n]