how can i run over a 2d array perimeter and check if there is a number that repet itself?
int matrix[N][N]={ {4,2,1,3,7},
{29,7,1,17,13},
{26,28,13,4,16},
{9,14,22,11,11},
{20,6,47,31,17}};
how can i check if for exmaple number 4 (mat[0][0]) appears in perimeter = 0?
perimeter = 0 == {4,2,1,3,7}
{29,-,-,-13}
{26,-,-,-,16}
{9,-,-,-,11}
{20,6,47,31,17}};
i need to check every number in that perimeter if its repet it self and check the folowing perimeter the same with its own numbers.
perimeter = 1 == {-,-,-,-,-}
{-,7,1,17,-}
{-,28,-,4,-}
{-,14,22,11,-}
{-,-,-,-,-}
if number 7 appear more than once in that perimeter return -1 for exmaple or number 1 or 17 and etc...
I would really appreciate the help, thanks in advance!!
Aucun commentaire:
Enregistrer un commentaire