#C11159. Palindrome Array Checker
Palindrome Array Checker
Palindrome Array Checker
You are given an integer n and an array of n integers. Your task is to determine whether the array is a palindrome. An array is a palindrome if it reads the same backward as forward. Formally, an array \(a_0, a_1, \ldots, a_{n-1}\) is a palindrome if \(a_i = a_{n-1-i}\) for all \(0 \leq i < n\).
If the array is a palindrome, output YES; otherwise, output NO.
inputFormat
The first line of input contains a single integer n (the number of elements in the array). The second line contains n space-separated integers representing the array.
Note: When n = 0, the array is considered an empty array and should be treated as a palindrome.
outputFormat
Output a single line containing either YES or NO depending on whether the array is a palindrome.
## sample5
1 2 3 2 1
YES