0

Input: An array of colors with weights. e.g [['red', 10], ['blue', 20], ['green', 30]]
Output: A random color from the array, based on it's proportion to the other colors. So for the example above, red should show up 1/6 of the time, blue 2/6, green 3/6.
I was asked this during an interview. Af...