Given an array S of size N , check if it is possible to split sequence into two sequences -
s1 to si and si+1 to sN such that first sequence is strictly decreasing and second is strictly increasing. Print true/false as output.
Here is my code
Scanner scn = new Scanner(System.in);
int n= scn.nextInt();
int [] arr = new int [n];
int count=9;
for(int i=0;i<arr.length;i++){
arr[i]=scn.nextInt();
}
for(int i=0;i<arr.length-1;i++){
if(arr[i+1]<arr[i]){
count=1;
}else if(arr[i+1]>arr[i]){
count=2;
}
}
if(count==2)
System.out.println("true");
else{
System.out.println("false");
}
Not able to satisfy test cases