Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What Am I Doing Wrong?

Name: Anonymous 2008-05-22 22:02

http://javabat.com/prob?id=AP1.scoresIncreasing

public boolean scoresIncreasing(int[] scores) {
  boolean increase = true;
 
  for (int i = 1; ((i) < (scores.length + 1)); i++){
  if (scores[i] > scores[i+1]){
  increase = false;
  }
  }
 
  return increase;
}

Name: Anonymous 2008-05-24 18:43

>>8
public boolean scoresIncreasing(int[] scores) {
  int i = 0;
  while (i < scores.length - 1)
    if (scores[i] > scores[++i])
      return false;
  return true;
}


OMGOPTIMIZED

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List