Check for a palindrome · Compiler

Check for a palindrome

Decide whether the values of the singly linked list read the same from head to tail as from tail to head. An empty list is a palindrome.

Input
Read n (0 <= n <= 100), followed by n integers in head-to-tail order. Each value is in [-1000, 1000].
Output
Print YES for a palindrome or NO otherwise.

Compiler Explorer runs your code when you run or check it.

Loading your exercise draft…