Palindrome Linked List
Medium Acceptance 41.48% Points 30.00
Given a singly linked list of integers. The task is to check if the given linked list is palindrome or not.
Examples
Example 1
Example 1
Input: LinkedList: 1 -> 2 -> 3 -> 2 -> 1
Output: true
Explanation: The linked list reads the same forward and backward, making it a palindrome.
Example 2
Example 2
Input: LinkedList: 1 -> 2 -> 3 -> 4 -> 5
Output: false
Explanation: The linked list is not symmetric, so it is not a palindrome.
Hints
Hint 1
Expected Time Complexity: O(n)
Hint 2
Expected Space Complexity: O(1)
Constraints
- 1 <= number of nodes <= 10^5
- 1 <= node->data <= 10^3
Companies
Amazon Microsoft Adobe
Track your submissions
Please log in to review your progress and explore code submissions from other participants.
Unlock the full solution
Please log in to access detailed answers and explanations.
Join the discussion
Please log in to join conversations with other participants.