We have a bag that contains N balls of different colors.
In each turn we pick two balls from the bag, one after another, and paint the second one with the first one's color.
After the paint dries, we put both balls back into the bag and shuffle its contents.
You are given a String colors describing the initial colors. More precisely, each character in colors
corresponds to a single ball. Balls represented by equal characters have the same color.
Return the expected number of turns until all the balls have the same color.
|