Rainbow problem

#include<stdio.h>
int main()
{

int T,N;

scanf("%d",&T);
int O[T],k=0;
if(T>=1 || T<=100)
{
	for(int i=0;i<T;i++)
	{
		scanf("%d",&N);
		if(N>=7 || N<=100)
		{
			int A[N];
			int counter = 0;
			for(int i=0;i<N;i++)
				scanf("%d",&A[i]);

			if(N%2!=0){
				for(int i=0;i<N/2;i++){
					//printf("A[i] : %d and A[N-i] : %d",A[i],A[N-i]);
					if(A[i]==A[N-i-1])
						counter++;
				}
				if(counter==N/2 && A[N/2]==7)
					printf("yes\n");
				else
					printf("no\n");
					
			}
			else{
				printf("no\n");
			}
			k++;
		}else
		{
			printf("no\n");
		}

	}
}
return 0;

}

Thats the third question this day lol. Where are you checking that each array element is less than or equal to 7? Specifically, 1<=arr[i]<=7. Rainbow array must have elements from [1,7]. Also, rainbow array can be of both, odd and even length.

Thanks man it worked.

Hehehehehe :smiley:

@swapnilnaik if the answer helped, you can accept the answer as right solution