Multidimensional Lists - Exercise - 06. Knight Game


Линк към judge е тук


The knight moves to the nearest square but not on the same row, column, or diagonal. (This can be thought of as moving two squares horizontally, then one square vertically, or moving one square horizontally then two squares vertically - i.e. in an "L" pattern.) 

The knight game is played on a board with dimensions N x N.

You will receive a board with K for knights and '0' for empty cells.

Your task is to remove knights until there are no knights left that can attack one another.

- On the first line, you will receive the N size of the board
- On the next N lines, you will receive strings with Ks and 0s.

Моят код:

06. Knight Game

Test #3, Test #4, Test #7, Test #8, Test #9, Test #10 дава грешка.

Дали имате идеи защо?

Благодаря предварително.



Да смени най-силня knight на "0" (и да има брояч за тези) след проверка на цял matrix и да продължава (от начало) докато няма strongest knight е решението.

Код е коригиран за 100/100.