Help me in solving TEMPLELA problem

My issue

hi

My code

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes; here
		Scanner sc=new Scanner (System.in);
		
		int s=sc.nextInt();
        for(int i=0;i<s;i++)
        {
            int n=sc.nextInt();
            int arr[]=new int [n];
            for(int ar=0;ar<n;ar++)
            {
                arr[ar]=sc.nextInt();
            }
            int count=0;
            for(int j=0;j<n/2 ;j++)
            {
                if((arr[j])!=arr[n-j-1])
                {
                    System.out.println("no");
                }
                else
                {
                    System.out.println("yes");
                    
                }
            }
        }
	}
}

Problem Link: Temple Land Practice Coding Problem - CodeChef

@manikanta2114
refer my c++ code for better understanding of the logic

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    int a[n];
	    for(int i=0;i<n;i++)
	    {
	        cin>>a[i];
	    }
	    if(n%2==0)
	   cout<<"no";
	   else
	   {
	       if(a[n/2]==(n+1)/2)
	       {
	           int ch=0;
	           for(int i=n/2-1;i>=0;i--)
	           {
	               if(a[i+1]-a[i]!=1)
	               {
	                   ch=1;
	               }
	           }
	           for(int i=n/2+1;i<n;i++)
	           {
	               if(a[i-1]-a[i]!=1)
	               {
	                   ch=1;
	               }
	           }
	           if(ch)
	           cout<<"no";
	           else
	           cout<<"yes";
	       }
	       else
	       cout<<"no";
	   }
	   cout<<endl;
	   
	}

}