Positions - Queen & Knight (Greedy Algorithm)
Positions - Queen & Knight (Greedy Algorithm) PROBLEM STATEMENT : Given a position of Queen and Knight. Form 8X8 matrix with all position filled with '0' and replace given Queen position with 'Q' and replace given Knight position with 'K'. Find number of possible moves where Queen can be moved on a chessboard from given position and replace the positions with 'q' and Find number of possible moves where Knight can be moved on a chessboard from given position and replace the positions with 'k' and if both queen and knight meets in same position then that position should be replaced with 'x'. Input Format: First line consist of row and column position of Queen First line consist of row and column position of Knight Output: 8X8 matrix with all possible moves of Queen and Knight. Example Input/Output 1: Input: ( ) 2 3 4 8 Output: 0 q q q 0 0 0 0 q q Q q q q x q 0 q q q 0 k 0 0 q 0 q 0 q 0 0 K 0 0 q 0 0 x 0 0 0 0 q 0 0 0 x 0 0 0 q 0 ...