# Minimum bits required to locate both kings in chess board ?

76 views

There is a 8 x 8 standard chess board. How many minimum bits one requires to locate both kings in the board at any point of time?

posted Nov 7, 2013

What is the meaning of a bit here i.e. is it represent a location?
Yes, bits will be used to represent locations.
One solution may be using one byte for each king as 1 byte can address 256 combinations.
So total possible ways are 2*64C2 i.e. 2*64*63/2 = 4032
so answer is 12 bits which can represent app possible ways to locate two kings.

I hope I understood the question.
You got the question and answer both right :).. I was hoping to get smaller number using symmetry or some other means.

+1 vote

So total possible ways are 2*64C2 i.e. 2*64*63/2 = 4032
so answer is 12 bits which can represent app possible ways to locate two kings.

I think 6 bits are enough.

For first King
first three is for row 0-7
Next three for column 0-7

Same for second King.

So total bit required is 12.

Similar Questions
+1 vote

Given an array of denominations and array Count , find minimum number of coins required to form sum S.

for example:

``````  coins[]={1,2,3};
count[]={1,1,3};
``````

i.e we have 1 coin of Rs 1 , 1 coin of Rs 2 , 3 coins of Rs 3.

Now if we input S = 6 then output should be 2 with possible combination : 3+3 = 6