For the best-case: Because there is a chance that you take two gloves of the same color in the first two round the answer is two.
For the worst-case: The worst case would be if, for each color-group of gloves you take the right or left glove, for example, you take 5 left-hand red gloves then 4 left-hand yellow gloves, then 2 left-hand green gloves, because you have already taken all of the left gloves the next one is going to be a right glove that is going to pair with one of the already selected gloves, therefore, the answer is 12 -> 5+4+2+1 = 12
Answer: BEGIN INPUT N IF N>0 AND N<10 THEN OUTPUT "blue" ELSE IF N>10 AND N<20 THEN OUTPUT "red" ELSE IF N>20 AND N<30 THEN OUTPUT "green" ELSE OUTPUT "It is not a correct color option" ENDIF END.