Write a C program to check if an array is a palindrome. An array is a palindrome if it reads the same forward and backward. Output "YES" if it is a palindrome, otherwise "NO".
Example 1
Input:
5
1 2 3 2 1
Output:
YES
Example 2
Input:
4
1 2 3 4
Output:
NO
Constraints
1 <= n <= 100
Input Format
n and array
Output Format
YES or NO
Sample Testcases
Submit runs every public testcase in this browser. Results and code never leave this device.
Sample #1
Public sample
Input
5
1 2 3 2 1
Output
YES
Explanation
1=1, 2=2.
Sample #2
Public sample
Input
4
1 2 3 4
Output
NO
Explanation
1!=4.
Sample #3
Public sample
Input
1
5
Output
YES
Explanation
Single el is palindrome.
Sample #4
Public sample
Input
2
1 1
Output
YES
Explanation
Two identical.
Web terminal
C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.