Given a two-digit array, the task is to find the maximum sum of an hourglass shape
In a two-digit array, this collection of numbers make an hourglass shape
a b c
d
e f g
There are a total of 16 hourglass shapes found in the sample input data
1 1 1 0 0 0
0 1 0 0 0 0
1 1 1 0 0 0
0 0 2 4 4 0
0 0 0 2 0 0
0 0 1 2 4 0
19
The "sample input" data contains the following 16 hourglasses.
1 1 1 1 1 0 1 0 0 0 0 0
1 0 0 0
1 1 1 1 1 0 1 0 0 0 0 0
0 1 0 1 0 0 0 0 0 0 0 0
1 0 0 0
0 0 2 0 2 4 2 4 4 4 4 0
1 1 1 1 1 0 1 0 0 0 0 0
0 2 4 4
0 0 0 0 0 2 0 2 0 2 0 0
0 0 2 0 2 4 2 4 4 4 4 0
0 0 2 0
0 0 1 0 1 2 1 2 4 2 4 0
The sum of the largest hourglass found in the input data is 19.
2 4 4
2
1 2 4
For example 2 + 4 + 4 + 2 + 1 + 2 + 4 = 19
You can contact me via gmail or at my website http://www.richardhollon.com or find me on