Estritamente crescente ou decrescente
Escreva um método que receba um array e determine se ele é estritamente crescente, estritamente decrescente ou nenhum dos dois.
Exemplos
Program.check(new int[]{1, 2, 3}) ➞ "increasing"
Program.check(new int[]{3, 2, 1}) ➞ "decreasing"
Program.check(new int[]{1, 2, 1}) ➞ "neither"
Program.check(new int[]{1, 1, 2}) ➞ "neither"Notas
- Se dois valores adjacentes forem iguais, o array não é estritamente crescente nem estritamente decrescente.
- Os arrays de entrada têm comprimento mínimo de 2.