Perfect Arrays
Submissions: 6035   Accuracy:

30%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Given an array of size N and you have to tell whether the array is perfect or not. An array is said to be perfect if it's reverse array matches the original array. If the array is perfect then print "PERFECT" else print "NOT PERFECT".

Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains an integer N (size of the array)and the second line contains N elements a0,a1,......aN-1 of an array .

Output:
For each test case, print either "PERFECT" or "NOT PERFECT" in new line as your answer.

Constraints:
1<=T<=100
1<=N<=100
1<=ai<=1000

Example:
Input:
2
5
1 2 3 2 1
5
1 2 3 4 5
Output:
PERFECT
NOT PERFECT

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: RIYA BHARDWAJ
Author: Riya Bhardwaj


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.