Dsa
Linked List
Medium
Palindrome Linked List
Given the head of a linked list, determine if it is a palindrome. A linked list is called a palindrome if the values read from start to end are the same as those read from end to start.
Input Format: The first line contains an integer n, the number of nodes. The next n lines contain integers, the values of the nodes.
Output Format: Print 'yes' if the linked list is a palindrome, 'no' otherwise.
Example:
Input:
5
1
2
3
2
1
Output:
yes
Key concepts
linked_listpalindrome
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now