**Hard Logic Amazon Interview Puzzle Solution - 13 December**

Two friends were stuck in a cottage. They had nothing to do and thus they started playing cards. Suddenly the power went off and Friend 1 inverted the position of 15 cards in the normal deck of 52 cards and shuffled it. Now he asked Friend 2 to divide the cards into two piles (need not be equal) with equal number of cards facing up. The room was quite dark and Friend 2 could not see the cards. He thinks for a while and then divides the cards in two piles.

On checking, the count of cards facing up is same in both the piles. How could Friend 2 have done it ?

**Update Your Answers at :**Click Here

**Solution***Friend 2 must have taken top 15 cards from the pile and reversed them. Now there are two piles, one with 15 cards and one with 37 cards and both of them will obviously have the same number of inverted cards.*

If you want to understand mathematically, let us say that there were x inverted cards in the top 15 cards of the deck. Then the remaining 37 cards will comprise of 15-x number of inverted cards.

If we reverse the 15 cards the number of inverted cards will become 15-x and the number of inverted cards will be same in both the piles.