Approach
Let us denote B for the black sock and W for the white sock.
The boy needs to take out at least two socks to find a pair of socks. A pair of socks taken out may contain one of the following: (B, B), (B, W), (W, W) and (W, B).
(B, B) and (W, W) are valid as they form the pair of the same colors of socks. But the other two are not valid.
When the boy takes out the third sock, the pairs may contain one of the following:
(W, W, W)
(W, W, B)
(W, B, W)
(W, B, B)
(B, W, W)
(B, W, B)
(B, B, W)
(B, B, B)
Now each one of them has a pair of Black or White socks, as seen below:
(W, W, W) has a pair of W socks
(W, W, B) has a pair of W socks
(W, B, W) has a pair of W socks
(W, B, B) has a pair of B socks
(B, W, W) has a pair of W socks
(B, W, B) has a pair of B socks
(B, B, W) has a pair of B socks
(B, B, B) has a pair of B socks
Thus the minimum number of socks the boy has to draw from his drawer is 3.
Check out this problem - 8 Queens Problem
Frequently Asked Questions
What are puzzles?
A puzzle is a game or problem that trains our brain.
What are the advantages of solving puzzles?
Puzzles train our brains and help us develop problem-solving skills.
What is the minimum number of times he has to draw socks to go out for school for ten black socks and ten white socks?
He has to draw a minimum of two socks to find a pair of socks of the same color. For example, he can draw a pair of Black socks or a pair of white socks.
What would be the answer to the question if there were ten black socks and only one white sock?
The answer would still remain 3. When he takes three socks out, he will always get one pair of black socks.
What would be the answer to the question if there were ten black, ten white and ten red socks?
The answer is 4. Whenever he takes four socks out, he will always get a pair of socks of the same color.
Conclusion
We have extensively discussed the answer to the puzzle, Ten Black and Ten White Socks.
Logical Puzzles:
Pattern Based Puzzles:
Recommended Readings:
Do check out The Interview guide for Product Based Companies as well as some of the Popular Interview Problems from Top companies like Amazon, Adobe, Google, etc. on Coding Ninjas Studio.
Also check out some of the Guided Paths on topics such as Interview Puzzles, Data Structure and Algorithms, Competitive Programming, Operating Systems, Computer Networks, etc. as well as some Contests, Test Series, Interview Bundles, and some Interview Experiences curated by top Industry Experts only on Coding Ninjas Studio.