Problem 11

Tue Feb 09 20:57:36 -0800 2010

The basic strategy is to only check to the east, south, southeast and southwest. By checking those we are implicitly checking north, west, northwest and northeast.

First note that we can parse the data into a reasonable data structure (array of arrays) with a single line of understandable code.

The rest is straight forward. For each number get the product of the surround numbers (checking boundaries) and add it to the list of all products. Then just grab the item in with the max value.

blog comments powered by Disqus