Skip to content

Instantly share code, notes, and snippets.

@Deathnerd
Created April 2, 2014 00:34
Show Gist options
  • Save Deathnerd/9925866 to your computer and use it in GitHub Desktop.
Save Deathnerd/9925866 to your computer and use it in GitHub Desktop.
public int maxSub(int m) {
int x = A[0][0];
int finalIndex=1;
int index = 0;
for (int i = 1; i <= m; i++) {
for (int j = 0; j < A.length; j++) {
index++;
int row = (index / size);
int column = (index % size)-1;
System.out.println("Row= ("+index+"/"+size+")="+row);
System.out.println("Column= "+index+"%"+size+"="+column);
System.out.println("Index total = "+index);
if(column == -1){
column = size+column;
row--;
}
if(A[row][column] > x){
x= A[row-1][column];
finalIndex = index;
}
}
}
return finalIndex;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment