N_knight Problem

anyone please explain
if N = 2 , and N
then how total number of valid configuration with N = 2 , knight is 6, e.g.

{0-0} {0-1} {0-0} {1-0} {0-0} {1-1} {0-1} {1-0} {0-1} {1-1} {1-0} {1-1}

For a 2*2 board, 2 knights cannot attack each other on placing them at any cell.
This is because a knight does not have enough space for movement.
Choosing any 2 cells out of 4 available gives 4C2 combinations = 6 combinations.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

please explain this output
{0-1} {1-1}
for n=2. how it come

lets say x denotes an empty cell and k denotes a filled cell
empty board:
x x
x x
now {0-1} {1-1} this corresponds to
x k
x k
{0-1} stands for 0th row, 1st column and {1-1} stands for 1st row, 1st column
now check if the 2 knights attack each other?
hence, this configuration is valid

1 Like

OMG !

Basically in this question we are finding safe position for two knight. and printing their index. For all possible configuration.

help me please.
my code code cover vertical but not cover horizontal consequitive safe place.
@Saurabh-Kumar-1331476656958199
@S18LP0016

Please check this code and please explain what am I doing wrong

check my solution.
@Akanshu