There are quite a few posts on the cloud categorized as 'Brainteasers' and here is the one I prefer throwing to an extremely promising candidate (Senior Developer, Architect) during my technical interview.
Situation 1: In a drawer, there are 5 Gray socks and 5 Black socks. What is the least (optimal) number of socks one has to draw (blind-folded) from this drawer which would gurantee a wearable (same color, in case you are wondering what the heck is 'wearable') pair of socks?
If one draws all the socks, in other words, 10 - that would gurantee a wearable pair of socks - but that would be an overkill, won't it? Remember, we are looking for the optimal number of socks. So, continuing further, let's bring down the number of socks, to draw, to 5. That would give the following possibilites..
One Color Another Color
Any of the combination ( a total 10) will certainly yield a wearable pair of socks. But, hang on - one sec!
Let's bring our number to 3 and see what we get (possible combinations: 6 - [ n* (n+1) / 2 ] )
One Color Another Color
Carefully observe the above combination - that would give a wearable pair of socks, for sure!
You can't go any lower than 3 as two of three possible combinations - would lead to an 'unwearable' pair of socks.
Situation 2: Extending theSituation 1, let's say in a drawer there are 5 pairs of Brown shoes and 5 pairs of Black shoes. What is the least number of shoes one has to get from the drawer, blind-folded, that will gurantee a wearable pair of shoes?
Before applying the analytical thinking as in Situation 1, mind you this time it is Shoe - which unlike Sock has distinct Left and Right !! Hmmn... I know you are just about getting there :-)
So what we have is the following:
5 Left Brown Shoes ( L-BR)
5 Right Brown Shoes (R-BR)
5 Left Black Shoes (L-BL)
5 Right Black Shoes (R-BL)
So, as before pick a number say 10 shoes - what can that yield - well, if you one of those buying Lotto Max every Friday, you may end up having 5 L-BR and 5 L-BL and that would certainly throw you off a wearable pair of shoes, won't it?
So bump that number from 10 to 11 and see what possibly the negative combination could yield. 10 lefties and 1 right (either R-BR or R-BL) and bingo..that would certainly give you a wearable pair.
Situation 3: A little twist to the Situation 2 - what is the least number of shoes one has to draw to get a wearable pair of Brown Shoes?
Continuing from the perspective for Situation 2 - a magic number 11 - that does not necessarily gurantee either a Black or Brown pair of shoes. Make that 13 - it still stays the same - you may have 3 Right shoes of the color other than you are looking for. Make that 15 - almost there.. you may end up having 5 L-BR, 5 L-BL and 5 R-BL.. so what you are looking for is + 1 (R-BR)
Hope you liked the perspectives presented here.