I'm hooked on this algorithm where I create an integer vector with n positions and need to show the largest consecutive sequence.
I'll leave the statement to try to be more specific.
"Create an algorithm where the user types 50 integers of a vector and at the end the program informs the size of the largest consecutive sequence increasing."
ex:
6,7,9. GreaterSequence = 2.
5,6,7,8,11. GreaterSequence = 4
What I've done so far:
public class Questao02 {
public static void main(String[] args){
String aux;
int a[] = new int[5];
int cont=0;
for(int i=0;i<5;i++){
aux = JOptionPane.showInputDialog("Números");
a[i] = Integer.parseInt(aux);
if(a[i] < a[i+1] ){
cont++;
}
else{
cont=0;
}
}
System.out.println(cont);
}
}