Skip to content

Commit

Permalink
fix: walking the metrix until the end
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Sep 16, 2017
1 parent 8291fc8 commit 918c874
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions problem11.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ func Problem11() int {
gp := 0

for y := 0; y < dim; y++ {
for x := 0; x < dim-win; x++ {
for x := 0; x <= dim-win; x++ {
gp = Max(grid[y][x]*grid[y][x+1]*grid[y][x+2]*grid[y][x+3], gp) // left => right
gp = Max(grid[x][y]*grid[x+1][y]*grid[x+2][y]*grid[x+3][y], gp) // up => down
}
}

for j := 0; j < dim-win; j++ {
for i := 0; i < dim-win; i++ {
for i := 0; i <= dim-win; i++ {
gp = Max(grid[j][i]*grid[j+1][i+1]*grid[j+2][i+2]*grid[j+3][i+3], gp) // diagonal leftTop => rightDown
gp = Max(grid[j+3][i]*grid[j+2][i+1]*grid[j+1][i+2]*grid[j+0][i+3], gp) // diagonal leftDown => rightUp

Expand Down

0 comments on commit 918c874

Please sign in to comment.