You are viewing a single comment's thread. Return to all comments →
Two cases are failing can anyone, help me:
int sum=0,maxSum=0; for (int i=0;i<6;i++) { for(int j=0;j<6;j++) { if(i<4 && j<4) { sum=arr.get(i).get(j)+arr.get(i).get(j+1)+arr.get(i).get(j+2)+ arr.get(i+1).get(j+1)+ arr.get(i+2).get(j)+arr.get(i+2).get(j+1)+arr.get(i+2).get(j+2); if(sum>maxSum) maxSum=sum; } } } System.out.println(maxSum);
Seems like cookies are disabled on this browser, please enable them to open this website
Day 11: 2D Arrays
You are viewing a single comment's thread. Return to all comments →
Two cases are failing can anyone, help me:
int sum=0,maxSum=0; for (int i=0;i<6;i++) { for(int j=0;j<6;j++) { if(i<4 && j<4) { sum=arr.get(i).get(j)+arr.get(i).get(j+1)+arr.get(i).get(j+2)+ arr.get(i+1).get(j+1)+ arr.get(i+2).get(j)+arr.get(i+2).get(j+1)+arr.get(i+2).get(j+2); if(sum>maxSum) maxSum=sum; } } } System.out.println(maxSum);