Skip to content

Instantly share code, notes, and snippets.

@cohen990
Created October 27, 2015 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cohen990/46d476750508bd34447c to your computer and use it in GitHub Desktop.
Save cohen990/46d476750508bd34447c to your computer and use it in GitHub Desktop.
int max = 0;
for(int i = 0; i < myArray.length; i++){
if(myArray[i] > max){
max = myArray[i];
}
}
int maxIndex = 0;
for(int i = 0; i < myArray.length; i++){
if(myArray[i] > myArray[maxIndex]){
maxIndex = i;
}
}
for(int i = maxIndex; i < myArray.length - 1; i++){
myArray[i] = myArray[i+1];
}
myArray[myArray.length - 1] = Integer.MINIMUM_VALUE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment