Increasing decreasing sequence

not sure with input statement some of the testcases are failed

code used
import java.util.*;
public class Main {
public static void main(String args[]) {

Scanner scan=new Scanner(System.in);
	int temp=0;
	int N=scan.nextInt();
	
	int s[] =new int[N];
	boolean flag=false;
	for(int i=0;i<N;i++)
	{
		
		
		 s[i]=scan.nextInt();
		
		
	
	}
	for(int i=0;i<s.length-1;i++)
	{
		
		
		if(s[i]<s[i+1])
		{
			temp=s[i];
			s[i]=s[i+1];
			s[i+1]=s[i];
			
			flag=true;
		}
		else 
		{
			flag=false;
			break;
		}
	
	
	

			
			
			
		
		
		
	}
	
		
		
		
		
		
		
		
	if(flag==true)
	{
		System.out.println("true");
	}

	else
	{
		System.out.println("false");
	}

	
	
	
	
	


	
	
	
	
}

}

see first of all while taking input it should be i<s.length
moreover the logic does not seem correct…

iterate over array and check if current element is greater or smaller than previous element

case1 : if it is greater means sequence is increasing here now for next time it can’t be decreasing
case2: if it is smaller than previous then it should not increasing before it

if these condition not hold true ans is “false” otherwise “true”

you can also solve it without using arrays because at any moment you just require the current element and the prev element