Meesho Coding Question – Solved

8 Live
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 (r1, g1, b1) and (r2, 82, b2), it is calculated as follows: d = square_root( (r1-r2)^2+ (g1-g2)^2+ (b1- b2)^2) 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.

Asked in: Meesho

Image of the Question

Question Image

All Testcases Passed βœ”



Passcode Image

Solution


Please login to view the solution


Related Questions

| The supply chain manager at one of Amazon's warehouses is shipping the last con… |
| Determine the highest value after executing n steps on an infinite 2D grid that… |
| Amazon Prime Video is developing a new feature called "Segmentify." This featur… |
| In this new stock prediction game launched on Amazon Games, Player 1 provides P… |
| Amazon operates numerous warehouses, with each warehouse holding inventory[i] u… |
| In Amazon's highly efficient logistics network, minimizing operational overhead… |