A problem by Kevin Yang
The first box has two white balls. The second box has two black balls. The third box has a white and a black ball.
Boxes are labeled for their contents but all labels are wrong!
You are allowed to open one box, pick one ball at random, see its color and put it back into the box, without seeing the color of the other ball.
How many such operations are necessary to correctly label the boxes?