samedi 30 juillet 2016

Finding perimeter of figure in matrix in Java

Iv'e been trying to code a program that takes a few coordinates and find the perimeter of the figure from a matrix like, which should output 14:

XX
X XX
XXX

The perimeter would be the sum of the outer unit sides. I've tried finding the outer square perimeter of the figure, but it only works with very little cases. Any suggestions?

Aucun commentaire:

Enregistrer un commentaire