I'm trying to count the longest string of consecutively increasing elements in a randomly generated array, MOODS. This code always returns one less than what is correct.
int maxDays = 0;
int days = 0;
for (int i = 0; i < MOODS.size() - 1; i++) {
if (MOODS.get(i + 1) > MOODS.get(i)) {
days += 1;
if(days>maxDays){
maxDays=days;
}
} else {
days = 0;
}
}
return maxDays;
}