Dsa
Linked List
Hard
Palindromic Sublist
Given a singly linked list of integers, determine whether any sublist of the linked list forms a palindrome.
Input Format:
- The first line contains an integer n (the number of nodes in the linked list).
- The next n lines contain one integer each, representing the nodes from head to tail.
Output Format:
- Print 'Yes' if any sublist is a palindrome, otherwise print 'No'.
Example:
Input:
5
1
2
3
2
1
Output:
Yes
Key concepts
linked_listtwo_pointer
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