Why my command prompt is showing correct answer but here its showing "wrong answer" ?

the link to the code is
https://www.codechef.com/problems/RAINBOWA

this is my code, please check and help me out

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

class universe
{
    public static void main(String args[])throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        
        int T=Integer.parseInt(br.readLine());
        for(int j=0;j<T;j++)
        {
           
            
            int N= Integer.parseInt(br.readLine());
            int[]a= new int[N];
            String st[] = br.readLine().split(" ");
            for(int k=0;k<N;k++)
             a[k]=Integer.parseInt(st[k]);
            int tb=0;
            for(int i=0;i<=(N/2);i++)
            {
                if(tb + 1==a[i])
                tb++;
                if(tb !=a[i] || a[i] !=a[N-i-1])
                break;
            }
            if(tb==7)
            System.out.println("yes");
            else
            System.out.println("no");
        }
    }
}
1 Like

Take a look at this test case:

1
15
1 2 3 4 5 6 7 999 7 6 5 4 3 2 1
1 Like

thanks, got it :slight_smile: