Number of moves:
you are given a nxn square chessboard with one bishop and k number of obstacles placed on it. A bishop can go to different places in a single move. find the total no.of places that are possible for the bishop in a single move. Each square is referenced by a type describing the row, R, and column, C, where the square is located.
explanation: given N=6 K=2
bishop position 5 2
obstacle positions (2 2), (1 5)
the bishop can move in so o/p is 6
I/p:
6 2
5 2
2 2
1 6
O/p:
6
I/p:
6 4
3 3
1 3
3 1
5 1
1 5
O/p: 7
The answer to your question is provided in the image:
Comments
Leave a comment