Dynamic programming: Find largest diamond (rhombus)

Posted by Darksody on Stack Overflow See other posts from Stack Overflow or by Darksody
Published on 2010-04-09T13:49:12Z Indexed on 2010/04/09 14:03 UTC
Read the original article Hit count: 299

Filed under:
|

I have a small program to do in Java. I have a 2D array filled with 0 and 1, and I must find the largest rhombus (as in square rotated by 90 degrees) and their numbers.

Example:

0 1 0 0 0 1

1 0 1 1 1 0

1 0 1 1 1 1

0 1 1 1 1 1

0 0 1 1 1 1

1 1 1 1 1 1

Result:

      1    

    1 1 1  

  1 1 1 1 1

    1 1 1  

      1    

The problem is similar to this SO question.

If you have any idea, post it here.

© Stack Overflow or respective owner

Related posts about java

Related posts about homework