Can anyone tell me how to approach in this question?

Number of minimum picks to get ‘k’ pairs of socks from a drawer

Can anyone tell me how to approach in this question?

Number of minimum picks to get ‘k’ pairs of socks from a drawer

Question statement is also not clear to me.

1 Like

The Given Link isn’t Working

Although for what i can understand the question would be like :

There are colored socks given(most probably black & white) and we need to tell in what minimum moves we can make k pairs (white-white or black-black)

Lets say if only two color of socks are present :

Black & white

1.In first move you will take out a sock it can be white or black … so moves = 1

2.In second move he can get a sock black or white but if in this move the color of sock which he/she got if does not matches with the previous sock color then you need to perform another move.

3.[you will only perform this move if second move didn’t satisfied]In third move id does not matter if the sock color is white or black you already have 1 piece both of both sock color. hence in third you can always form a pair…

`So the answer becomes 3 when you need to find only 1 pair of sock when only 2 color type of socks are present in drawer.`

`If we want to extend it to k pairs with above conditions being same then you can observe that the answer is just moves = 2*k+1, k being the pairs to be formed.`

`If you want to extend it more further by making P colored socks present in drawer and you need to find K pairs in minimum picks then again observe that to get the first pair P+1 moves are required and then in every 2 moves a pair will always be formed hence the final answer becomes : `

```
// K is numbers of socks pairs to be formed
// P is the number of sock colors
// MOVES is the minimum valid moves required
MOVES = 2*K + P - 1
```

When I am opening , it’s working fine .

Sorry, don’t know what is mistake there.

But still you have understood what i want to ask .

Please elaborate it.

Did anyone understand what this question means?

the question statement is not clear to me.

It would be beneficial if someone can explain it in a more simple manner