# chef and new recipe may challenge-2015

can any one explain this-“she realizes that she can only pick one item at a time from the box and can know its type only after she has picked it out. The picked item is not put back in the bag.”.
Are all the item in the array are distinct?
can any one explain the test cases for -1.thanks.

That depends. It could be distinct-if yes then there are no same type of elements more than-so in this case answer will be -1. Because you can’t get a single type of elements more than 2.

Now next part is in the storage box there are multiple elements, and you can’t get to know their type until you you pick it out. So when a single element in the storage box, you won’t be able to know it’s type. When this element is out of the box-you can choose if you want to select it or not.
If any confusion feel free to ask.
Thanks.

how the answer for test case 1 is 4 and for case 2 it is 2.In case 2 only one item is there and it is distinct.

Case 1-There are 2 types of elements in box. Let’s denote them by a,a,b,b. You’ve to get the 2 a and 2 b types of elements. First you pick up a,then b,then a,then b. So finally you got all 4 elements. Maximum no of pick-up was 4.

Case 2- There are 1 type of element in box. Let’s denote them by a. So you’ve got 6 elements of type a. So you’ve to get 2 a element. First you pick up 2 elements from the box and you’ve already got the 2 elements of type a. So the answer is 2.