Created
April 2, 2014 00:34
-
-
Save Deathnerd/9925866 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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