Submit | All submissions | Best solutions | Back to list |
EIUPH009 - Palindrome array |
Summer quarter will end soon, EIU Programming Club started preparing for the upcoming OLP. The first problem to warm up is checking if the array is symmetric. The array is symmetric if the elements read from the beginning to the end are same as when reading from the end to the beginning.
Summer quarter will end soon, EIU Programming Club started preparing for the upcoming OLP. The first problem to warm up is checking if the array is palindrome . The array is palindrome if the elements read from the beginning to the end are same as when reading from the end to the beginning.
Input
The first line contains an integer n that is the length of the array (n<=10^5).
The second line contains n integers that are the elements in the array. Each element is represented by a signed 32-bit integer.
Output
If the given array is a palindrome , output "YES" otherwise output "NO".
Example
Input: 5 6 5 4 5 6 Output: YES
Input: 6 6 5 4 3 5 6 Output: NO
Added by: | Ha Minh Ngoc |
Date: | 2015-01-28 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYTHON3 RUBY SQLITE SWIFT VB.NET |