Company: Infoedge_23aug
Difficulty: medium
Save the Knight Problem Description You are given an n x n chessboard with the positions of a knight and a queen. The objective is to find the number of moves the knight can make without being attacked by the queen. The queen can attack in all eight directions: horizontally, vertically, and diagonally. A move is considered valid if the knight can reach that position in one move without being in the queen's line of attack. Determine the count of such valid moves for the knight on the given chessboard. Input Format The first line of input contains the row position of the knight, knightRow . The second line contains the col position of the knight, knightCol . The third line contains the row position of queen, queenRow . The fourth line contains the col position of queen, queenCol . The fifth line contains the size of the chessboard(n), chessSize . Examples Example 1: Input: 2 2 2 4 4 Output: 4 Explanation: The starting position of the Knight is (1,1). As seen in the picture, the knight ca