Odd-length palindrome
Input
[1, 2, 3, 2, 1]
Output
True
The sequence reads the same forwards and backwards.
Full lesson preview
Determine whether a singly linked list reads the same forwards and backwards.
Problem statement
Task
Examples
Input
[1, 2, 3, 2, 1]
Output
True
The sequence reads the same forwards and backwards.
Input format
Output format
Constraints
Samples
Input
[1, 2, 2, 1]
Output
True
Even-length palindrome.