Skip to content

To find the total number of positions that are not attacked by any knights on the chessboard.

Notifications You must be signed in to change notification settings

razeen11/knight-attacks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

knight-attacks

Given a chessboard, and N knights placed at positions marked by A-H,1-8. Print the total number of positions on the chessboard which are not attacked by any knight. Also print the position A-H,1-8 which is attacked by maximum knights. If more than one position is most attacked, then print -1. The position where the knight id present is considered as an un-attacked position unless that position is attacked by another knight.

Note: A Knight attacks in L-shape 8 positions around it..


Input format: String containing position of all knights

Output format: An Integer indicating Number of unattacked positions String Indicating Position with maximum number of knight attacks (Example : A4) or -1 if more than one position is max attacked


Sample testcases...

Input: -

A1E3

Output: -

55

C2

Explanation of sample output: -

image

About

To find the total number of positions that are not attacked by any knights on the chessboard.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages