#C14264. Check Palindrome Array
Check Palindrome Array
Check Palindrome Array
You are given an array of integers. Your task is to determine whether the array is a palindrome. An array is a palindrome if for every index \(i\) (where \(0 \le i < n\)), the following condition holds:
\(a[i] = a[n-1-i]\)
If the condition holds, output True
; otherwise, output False
. Note that an empty array and a single element array are both considered palindromes.
inputFormat
The input is read from standard input (stdin) and has the following format:
n a[0] a[1] ... a[n-1]
Here, n
(an integer) denotes the number of elements in the array, followed by n
space-separated integers representing the array elements.
outputFormat
Output to standard output (stdout) a single line containing either True
or False
, which indicates whether the array is a palindrome.
5
1 2 3 2 1
True