Palindrome array
Xem dạng PDF
Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
256M
Input:
stdin
Output:
stdout
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch, TEXT
Palindrome Array
An array is called a palindrome if its elements are the same when read from left to right and from right to left.
Given an array of integers, determine whether it is a palindrome.
Input
The first line contains an integer n, the length of the array.
n <= 10^5
The second line contains n integers representing the elements of the array.
Each element is a signed 32-bit integer.
Output
Output YES if the array is a palindrome.
Otherwise, output NO.
Example 1
Input
5
6 5 4 5 6
Output
YES
Example 2
Input
6
6 5 4 3 5 6
Output
NO
Bình luận