You are viewing a single comment's thread. Return to all comments →
int maxSum = Integer.MIN_VALUE; for(int i = 0; i <= arr.length -3; i++){ for(int j = 0; j<= arr[i].length -3; j++){ int perHrGlassSum = Integer.MIN_VALUE; perHrGlassSum = arr[i][j] + arr[i][j+1] + arr[i][j+2] + arr[i+1][j+1] + arr[i+2][j]+ arr[i +2][j+1] + arr[i+2][j+2]; if(perHrGlassSum > maxSum){ maxSum = perHrGlassSum; } } } return maxSum; Try this.
Day 11: 2D Arrays
You are viewing a single comment's thread. Return to all comments →