Algorithm · Google · Easy
You are given a string color holding a valid 7-character hexadecimal RGB color written as #RRGGBB. Among all colors that can be written in the three-digit shorthand form #RGB, find the one closest to color, and return it in its full 7-character form. In the shorthand form, each digit stands for two identical digits, so #09f expands to #0099ff. The distance between two colors is the sum of the squared differences of their red, green, and blue components. If several shorthand…