#C13811. Check if a List is a Palindrome
Check if a List is a Palindrome
Check if a List is a Palindrome
Given a list of integers, determine whether the list is a palindrome. A list is considered a palindrome if it reads the same from left to right as it does from right to left. In mathematical terms, a list \(L\) is a palindrome if \(L = L^R\), where \(L^R\) denotes the reverse of \(L\).
Your task is to implement a solution that reads the input from stdin
and writes the output to stdout
. The output should be True
if the list is a palindrome, and False
otherwise.
inputFormat
The first line of the input contains a single non-negative integer \(n\) which indicates the number of elements in the list. The second line contains \(n\) space-separated integers that constitute the list. If \(n = 0\), the list is empty.
outputFormat
Output a single line containing True
if the given list is a palindrome, or False
otherwise.
6
1 2 3 3 2 1
True