## Amazon Interview Question

Software Development Managers**Country:**United States

The answer is C(64, 16)*C(16, 8) / 2, assuming there is no orientation for the chess board.

The chess board is symmetric diagonally, hence devided by 2.

(the case where one white coin is on top-left corner is the same as it is on the bottom-right)

It seems reasonable to think that the chessboard has a fixed orientation and that configurations that are rotated versions of other configurations are nonetheless considered distinct, and orientation does matter in chess, so you're probably the only one that interpreted the problem this way. Still, that's a good case to think about & clarify with the interviewer.

Select 8 for white out of 64 and then select 8 for black out of remaining (56),so:

64c8 * 56c8

further you notice that you can select first black and then white ,so

No. Of ways to select would be : 2* 64c8 *56c8

64P16/8!*8!. Permute 16 coins in 64 squares. For each permutation there are 8! (black) * 8! (white) repetitions.

No. You should not double-count. The answer is (64 C 8)*(56 C 8), which is the same as (64 C 16)*(16 C 8) [select 16 spaces first, and then select which will be black and which will be white].

You should not multiply by 2 just because you can pick white first or you can pick black first. The order in which you pick doesn't affect what ends up being on the board.

Assuming no restriction on the color of cell of chess where a coin will be placed.

There are C(64, 16) ways to pick 16 places where coins can be placed.

In any of the above picked 16 places, there are 16! ways to place coins. Since 8 coins are white and to be considered same. Similar logic for black coins. The number of ways reduces to (16!)/(8! * 8!)

Total number of ways to place = C(64, 16)*(16!) / (8! * 8!)

If there are no restrictions on placing black and white coins.

Then we can select one square out of 64 as 64C1 and then one coin out of 16 as 16C1, next we have 63 squares left and 15 coins. So the equation comes out to be

64C1 * 16C1 + 63C1 * 15C1 + 62C1 * 14C1 + . . . . + 49C1 * 1

nth term is = (n+48) * n

sum it over n=1 to n=16 and you will get the answer.

C(64, 16) * C(16, 8)

- Anonymous July 15, 2012