🎁 Exclusive Offer! Join our Telegram Channel to get **special discounts** and updates! 🚀

🚀 Struggling with coding interviews? We've got you covered! 💡 Practice real questions, sharpen your skills, and land your dream job! 🎯
Question 19 - 100% Working Solution | Buy Now

Description

10 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