Increasing Decreasing

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

@shubhamkumarsingh,
Wrong answer for:
2
2 2
Correct Answer : false
Your Answer : True

I am running my code on this test case and it is showing false

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; // System.out.println(count); } else if (arr[i + 1] > arr[i] && count == 1) { count = 2; } } if (count == 2) System.out.println(“true”); else { System.out.println(“false”); } } }

@shubhamkumarsingh,
Your code is failling even the sample test case. Remember in case the sequence is increasing, its acceptable. https://ide.codingblocks.com/s/183781 I have corrected your code

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

not able to pass one test case and not able to find the proble in my code here is my code https://ide.codingblocks.com/s/352247

can i see the test cases after successfully submission of my code and did it lead to deduction im my marks